So far I’ve been more convinced by Crystal than Elixir as the next language for a Ruby developer.
Crystal is not the next language for this Ruby developer. Ruby remains it, along with JavaScript when Node makes sense. It often feels like the folks evangelizing Crystal really don't get why people use Ruby--if I need static typing I'm going to go use Kotlin or Rust or C++; looking like Ruby and not having any of the things that make Ruby valuable to me (namely, the features implied by dynamic typing, and to forestall the usual, no, Crystal macros don't replace it) is a demerit, not a positive.
And that's when the Static Typing Is The One True Way person parachutes in. :)
My suggestions are: simple to average web apps, stay with Ruby (Rails) or Python (Django); complex, look into Elixir (Phoenix.)
I never used Crystal so I can't say anything about it.
There is a dedicated contingent promoting Crystal in every thread about Ruby. Don't really know that we need any more (better, perhaps, but not more.)
> Basically Ruby with C performances.
Well, vaguely Ruby-ish syntax, without the dynamic features or ecosystem, and with a static type system.
> So far I’ve been more convinced by Crystal than Elixir as the next language for a Ruby developer.
Not sure what that has the do with the subject here, which has nothing to do with either Elixir or the next language for a Ruby developer.
Language (or tool) evangelism with no connection to be thread beyond offering an alternative to a language mentioned in the thread is basically a uniquely geeky form of threadcrapping, and its really not any better than any other threadcrapping.
Go to Elixir if you actually want to learn more, expand your mind, and are tired of bugs that can only occur in a mutable OOP language. And if you want to take advantage of the extra guarantees provided by a functional language, such as functional immutable datastructures making concurrency idiotproof.
Maybe rein it in a bit.
Seriously, try converting over a decently complex script to crystal from ruby, you'll run into complicated problems.
One difference in Java was that you could slice out the middle of a string (you just kept the start and end of the array, iirc). I wonder if that difference makes this approach workable for Ruby, or if that implies that one team made a mistake.
Thanks for the comment! <3
1) If you intern all strings, then you're guaranteed to have one copy of "Hello World", which this doesn't (you could concatenate "Hello" and "World" twice).
2) String interning doesn't let similar strings share the same array. The Ruby trick lets you have
"Hello World"
"World"
"orld"
"rld"
"ld"
"d"
all share the same underlying array, whereas string interning gives you a separate array for each.Also, his talks are excellent; his closing keynote for RailsConf in particular seems worth recommending, as it was about his work speeding up Rails using kind of similar string optimizations/caching:
Granted that's worse that it'd be for MRI, as it includes allocating actual objects even for Fixnum and Symbol (MRI uses tagged values for both and just pretend they're "real" objects), though I added caching for both that cut hundred of thousands of allocations..