* Syntax: Crystal’s syntax is heavily inspired by Ruby’s...
* Type System: Crystal is statically type checked...
and so on
* Syntax: Crystal’s syntax is heavily inspired by Ruby’s...
* Type System: Crystal is statically type checked...
and so on
I don't really see a "why use Crystal instead of Ruby" (or any other language, really) explanation anywhere. Maybe the things listed on the main page are meant to be that? Even if it's not on the main page a comparison would be nice in the docs (https://crystal-lang.org/docs/) or the reference (https://crystal-lang.org/reference/)
Or, with apologies to the late Douglas Addams, Crystal is almost, but not quite, entirely unlike Ruby.
Crystal is a programming language with the following goals:
Have a syntax similar to Ruby (but compatibility with it is not a goal) Statically type-checked but without having to specify the type of variables or method arguments. Be able to call C code by writing bindings to it in Crystal. Have compile-time evaluation and generation of code, to avoid boilerplate code. Compile to efficient native code.
Why? We love Ruby's efficiency for writing code. We love C's efficiency for running code. We want the best of both worlds. We want the compiler to understand what we mean without having to specify types everywhere. We want full OOP. Oh, and we don't want to write C code to make the code run faster.
Matz even mentioned Crystal as a study case while explaining what Ruby's static type system would be like - back in 2016[1].
[0] https://manas.tech/blog/2016/04/01/the-story-behind-crystal/ [1] https://youtu.be/1l3U1X3z0CE?t=1755