Crystal is a very nice language. It is strongly-typed and inspired by Ruby's syntax but not identical to Ruby. Crystal's performance is excellent, but compiling is a little slow. (And no Windows support yet - but under development.)
Given these features, there does not appear to be much adoption of Crystal among Ruby developers. It is still early days for the language (post 1.0 release).
Some questions for Ruby developers:
- Have you taken a look at Crystal?
- What is your impression of Crystal?
- Are there any features that would make you use the language? (Or reasons for not using Crystal?)
I have 15 years+ of ruby experience. Recently had to do some data munging for science, mostly string manipulation. So many strings, the python script someone had made said it would take 8 hours.
This was my first attempt with Crystal. It took me about 40 min to get it working, about twice as long as it would have taken in ruby.
Crystal is currently my go-to language when I want to try something out, like a new algorithm, data structure or problem, and I want to write it in Ruby and have the Ruby kind of fun doing it, but I also want it to be fast and consistent (like in Ruby you can do N-sized input and in Crystal you can do N*10).
I don't use it for work because I work for a Rails shop and we're currently happy with Rails.
Been writing Ruby the past 3 years. I loved Crystal, because the syntax and idioms were familiar but the type system reminded me of SML, which I miss greatly. I wrote a tiny compiler in it, but didn’t use it again because I had no reason to.
Unfortunately, I’m not sure what could be added to Crystal to make it stand out. The programming language space is somewhat bloated, and IMO to find a niche that doesn’t intersect with Ruby, Crystal needs to be able to compete with Rust and C/C++(Rust as the current novelty systems language of choice, C/C++ as the incumbent). I’m not sure if Crystal has a chance competing with Ruby/Python on their turf (hacking together scripts and web apps).
Still not as nice as Ruby, but pretty slick and OK. Seems less mature and less useful than something like Nim, despite the similarities with Ruby.
> Are there any features that would make you use the language? (Or reasons for not using Crystal?)
Back in the day, the lack of any decent support for parallelism. It seems they do have a strategy for it now which seems ok. But on a whole, Ruby is fast enough for my needs and Crystal still isn't as easy to use.
Edit - so just translated one of the benchmarks I use to test programming languages (economics benchmark, basically creates a bunch of arrays, performs a bunch of operations on them, compares them, etc..., that sort of thing - so lots of maths and looping) and Crystal is now slightly quicker than Nim although it produces an erroneous result so I'm curious about it's float64 implementation. Or maybe I got some syntax wrong going from Ruby -> Crystal.
Also, if anyone's curious, times on the benchmark I used (and everything is written in naive code, except Python which uses Numpy data structures so presumably some optimisation there?)
I was interested in it as a possible language to write cross platform desktop apps in, since distributing end user apps with ruby is a pain, but the lack of windows support made that a non starter.
I really like crystal (coming from ruby 10 years ago) and I still check it from time to time, but the number one showstopper for me using it more is that static linking is not possible like in Go or Rust.
Just compile a binary from my Mac and send it over to peers or compile it within a Github Action/scp it to a plain new linux server/run it - a comfort I am not willing to give up.
Not all shows need portability so why stop them all? Desktop applications absolutely, but It's trivial to build, deploy and operate docker containers on servers.
It started as sort of a faster version of Ruby, and now is going its own way. It makes sense, as Ruby is an extremely powerful yet simple language, but once you start using it you often wonder how many more applications it could address if it was faster, which is the problem that Crystal wants to solve.
Crystal is also smaller than Ruby, so it can become a suitable choice in embedded systems and generally under resources constraints.
From their GitHub:
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.
It's a compiled, statically-typed alternative to Ruby. If you like Ruby, but you want more performance, and you want your code compiled with static checks, then Crystal is a good alternative. The tradeoff is losing some of the more dynamic, metaprogramming capabilities.
Besides syntax, the home lists quite a few other items: static type checking, meta programming, concurrency.
I don't think it's fair to ask makers of a general programming language to specify what it's for. It's general. I guess the eco system might drive adoption in specific areas, but the language designers don't control the eco system.
[+] [-] open-source-ux|4 years ago|reply
Given these features, there does not appear to be much adoption of Crystal among Ruby developers. It is still early days for the language (post 1.0 release).
Some questions for Ruby developers:
- Have you taken a look at Crystal?
- What is your impression of Crystal?
- Are there any features that would make you use the language? (Or reasons for not using Crystal?)
[+] [-] KarlKemp|4 years ago|reply
This was my first attempt with Crystal. It took me about 40 min to get it working, about twice as long as it would have taken in ruby.
It then ran for 20 minutes and was done.
[+] [-] Toutouxc|4 years ago|reply
I don't use it for work because I work for a Rails shop and we're currently happy with Rails.
[+] [-] helen___keller|4 years ago|reply
Unfortunately, I’m not sure what could be added to Crystal to make it stand out. The programming language space is somewhat bloated, and IMO to find a niche that doesn’t intersect with Ruby, Crystal needs to be able to compete with Rust and C/C++(Rust as the current novelty systems language of choice, C/C++ as the incumbent). I’m not sure if Crystal has a chance competing with Ruby/Python on their turf (hacking together scripts and web apps).
[+] [-] Doctor_Fegg|4 years ago|reply
- needless differences to Ruby: for example, the devs have refused to implement single-line if...then...end simply because they don't like it (https://github.com/crystal-lang/crystal/issues/4117)
- cryptic error messages, mostly type-related: this might have got better in subsequent releases, I guess.
[+] [-] Mikeb85|4 years ago|reply
A bunch of times.
> What is your impression of Crystal?
Still not as nice as Ruby, but pretty slick and OK. Seems less mature and less useful than something like Nim, despite the similarities with Ruby.
> Are there any features that would make you use the language? (Or reasons for not using Crystal?)
Back in the day, the lack of any decent support for parallelism. It seems they do have a strategy for it now which seems ok. But on a whole, Ruby is fast enough for my needs and Crystal still isn't as easy to use.
Edit - so just translated one of the benchmarks I use to test programming languages (economics benchmark, basically creates a bunch of arrays, performs a bunch of operations on them, compares them, etc..., that sort of thing - so lots of maths and looping) and Crystal is now slightly quicker than Nim although it produces an erroneous result so I'm curious about it's float64 implementation. Or maybe I got some syntax wrong going from Ruby -> Crystal.
Also, if anyone's curious, times on the benchmark I used (and everything is written in naive code, except Python which uses Numpy data structures so presumably some optimisation there?)
C++: 1.05 seconds
Crystal: 1.3 seconds (but wrong result, for now)
Nim: 1.4 seconds
Ruby --yjit: 35 seconds
Ruby --jit (mjit): 40 seconds
Python3 (using numpy): 100 seconds
Ruby no jit: 120 seconds
[+] [-] zem|4 years ago|reply
[+] [-] anonyfox|4 years ago|reply
Just compile a binary from my Mac and send it over to peers or compile it within a Github Action/scp it to a plain new linux server/run it - a comfort I am not willing to give up.
(No, docker stuff doesn't cut it)
[+] [-] ksec|4 years ago|reply
Which part [1] of it is not possible?
[1] https://crystal-lang.org/reference/guides/static_linking.htm...
[+] [-] nsotelo|4 years ago|reply
[+] [-] xpressvideoz|4 years ago|reply
Wait, that Nikola is a sponsor? How? Why?
[+] [-] colesantiago|4 years ago|reply
As long as funding is going towards improving the language and ecosystem, I really don't see the issue here.
[+] [-] a_lost_needle|4 years ago|reply
[+] [-] unknown|4 years ago|reply
[deleted]
[+] [-] PostThisTooFast|4 years ago|reply
[deleted]
[+] [-] rcaught|4 years ago|reply
[deleted]
[+] [-] midenginedcoupe|4 years ago|reply
[deleted]
[+] [-] squarefoot|4 years ago|reply
[+] [-] Toutouxc|4 years ago|reply
[+] [-] hencoappel|4 years ago|reply
[+] [-] goatlover|4 years ago|reply
[+] [-] hibbelig|4 years ago|reply
I don't think it's fair to ask makers of a general programming language to specify what it's for. It's general. I guess the eco system might drive adoption in specific areas, but the language designers don't control the eco system.