1. 19
  1.  

  2. 7

    Having written a few small personal tools in Crystal, I must say the language is a pure joy to use.

    Coming from Ruby, there are some noticeable differences, but overall anyone comfortable in Ruby should be able to jump into Crystal just fine.

    1. 6

      Crystal fails a certain canary of mine, which I think the Crystal dev consider as correct behaviour:

      puts 1=="1"
      => 
      false
      

      I’d rather prefer code like this to be a type error. Languages somewhat like Crystal that do this “correctly” include at least Nim, Common Lisp (at least certain implementations) and Typescript. I can understand that other people like this though, but it’s not for me.

      Crystal is a very nice language generally speaking though, and I hope they get 1.0 out soon, so that it can be considered as a serious production option.

      1. 5

        Crystal feels like a cleaner, more consistent Ruby to me, without many of the mistakes/cruft built up over the years. Some things I liked/noted from my brief look at the language last year (was awhile ago so not sure of the accuracy):

        • The standard library (much more consistent, useful, HTTP client, etc.)
        • One kind of heredoc which works the way you probably want it to
        • ‘./lib’ being in the require path by default (and require supports ‘*’ and ‘**’ globs)
        • The property/getter/setter macros seem like better versions of the attr_* methods
        • Syntax sugar for assigning instance variables in the initializer
        • Testing inspired by rspec
        • Channel-based concurrency
        • Optional type annotations (and not the weird bolted-on way Ruby is looking at doing it)
        • A unified database API

        I think they’ve been very clever about what they’ve decided to keep, and what they’ve decided to change.

        1. 3

          crystal is a nice language with a lot of great features, but the lack of windows support is a definite barrier to adoption. the last section should have at least mentioned that.

          1. 1

            Why should developers support an OS which makes their lives harder? Windows sucks.

            1. 3

              … Because it’s a significant barrier to adoption? It’s fine to not support it, but you gotta admit that’ll make it less popular.

              1. 1

                sure, but if i’m writing a library or application i would ideally like as many people to be able to use it as possible. all the other languages i use let me develop on linux and get a potential windows userbase for free. i’m sure i’m not the only person in that boat.

                note that i’m not saying the crystal developers need to support windows, i’m saying that an article which tries to list barriers to crystal’s adoption need to add that one if they want to be accurate.