In other words, isn’t describing Crystal as “Ruby with types” similar to describing C++ as “JavaScript with types”?
In other words, isn’t describing Crystal as “Ruby with types” similar to describing C++ as “JavaScript with types”?
Crystal's intent, as I see it, is very different from Ruby's. Because it compiles down to machine code in a single executable, it's good for making things that are fast and easy to deploy. I've used it to make small web services as well as the bigger thing I mentioned above.
https://github.com/wouterken/crystalruby
It allows you to call crystallize on a ruby method and then have it recompile with crystal and called over FFI, which is pretty neat.
It would be really cool if this trb syntax could get close to the crystal syntax for method signatures at least.
I'd love to be able to move chucks of hot code to Crystal but leave everything else in ruby for compatibility with existing projects.
But it's not a migration path for Ruby codebases to add types, like the new initiatives for type annotations are. It's just that the syntax used by the available options has been somewhere between bad and downright terrifying until now.
So, you extremely rarely can run Ruby code in Crystal. But simple scripts are trivial to annotate. Larger apps won't require huge changes, but you're likely to run into dependencies you also need to port.