HACKER Q&A
📣 open-source-ux

The Crystal programming language – what are your impressions?


It's a compiled language with Ruby-inspired syntax (but not identical to Ruby). It has fast performance and a good standard library. Version 1.0 of the language was released in March 2021.

Some disadvantages:

- Compilation is a bit slow

- Small community

- Few learning resources

- Windows version is still under development (not 1.0 ready)

I'm impressed by the language and find it very likable. It's not often discussed on HN, which is a shame.

If you are using Crystal, or have taken a look at the language, what are you thoughts on the language?


  👤 iostream24 Accepted Answer ✓
I’ve taken several clients projects from conception to production with crystal lang.

It’s more production ready than much I’ve encountered elsewhere with less need for external “shards” or libraries.

The executables are small and to give you one example: a nodejs app that used 500mb of ram is now consuming 25mb as a crystal executable that doesn’t require any minding and happily runs for months with no change in the overall memory consumption or evident leakage. This executable was built on the same machine it runs on and can use normal systemd units and controls etc.

The standard library is built for purpose and has most of what you need.

I agree that compile times are slower than ideal but not like c++ slow or anything, like 30 seconds for one app that’s roughly 30k LOC fwiw.

I use a combo of standard lib .ecr server rendered templates and named js bundles from the frontend build toolchain to speed up the dev cycle. Most backend functionality in crystal works as intended once it compiles.

I really wouldn’t consider anything but Rust an improvement (gets rid of our Boehm GC) as crystal is just nicer to work with than Go, and less hassle or nonsense than c or c++…

Obviously it blows the doors off anyway interpreted even with native extensions… it is FAST


👤 valbaca
> It's not often discussed on HN, which is a shame.

It absolutely is. In fact, it's how I found out about the language. There's been several conversations about it and each release is posted on HN. For example: https://news.ycombinator.com/item?id=27903288

Crystal as a language is fantastic IMO. The type system literally forces you to consider race-conditions. Never had a language make me eat my vegetables in such a way. The code runs incredibly fast (on par with Rust and Go).

However, like the points you listed, it's hasn't "gone critical." It needs the basics to get even a hundredth of a percent of traction: cross-platform, IDE support, and some "killer" use-case.


👤 packetlost
I tried to write a non-trivial application in Crystal and have built some opinions on it:

* It has nice features, seems decently fast (I wasn't able to fully test just how fast)

* The language is complicated, there's so many built-in language constructs it doesn't fit in my head cleanly. I often found myself forgetting about entire features of the language by the time it was appropriate to use them

* The stdlib is decently documented, has good coverage

* Type system is top notch, tagged union types are the future of static typed languages IMO

* It's very not mature. I encountered many poor error messages, seeming compiler errors, poorly documented behavior, etc.. It has potential, but I wouldn't recommend it for production use today.


👤 JohnDeHope
Crystal is a niche within a niche. Only somebody interested in ruby will care, and then only somebody interested in ruby who is also interested in the use cases where crystal is superior to ruby will care. By now you're in a pretty small subset of the overall programming community. This is bad enough.

Worse, the use cases that crystal aims to solve for ruby, are not things that would attract people to ruby in the first place. Few people need a compiled language and reach for ruby, to find it lacking, and then look at crystal. The people with problems that crystal solves were never looking at ruby in the first place. They're not interested in tricks like `1.day`.


👤 sph
Good of you to ask, it's come into my radar this week, and I'm writing a toy project with it (https://github.com/1player/fancy).

My impressions:

* it feels pretty fun and productive. Right now only Elixir feels better than that, so it's good to have fun on the system programming space.

* it's too slow to compile. This is a major pain point for me, iteration speed should be priority #1. I'd love a REPL.

* it's incredibly easy to hack on the compiler. I sent today my first PR to fix a bug in the stdlib.

* great stdlib, needs better documentation, again Elixir would a great inspiration for how to write docs. I'd love more monadic functions to deal with nils.

* github feels healthy and very active, but the whole ecosystem feels like it's stalled in the past 2 years. Pretty much nobody talks about it, most deps haven't been updated in years, it has a ghost town feel.

* it would fit nicely in my list of favourite languages. Zig for very low level, Crystal for native high level, Elixir for daemons and long running services.

Verdict: I like it a lot, it could be my favourite system programming language, but outreach and hype would give me some hope it's going somewhere and not dying a slow death.


👤 singularity2001
The mix of beautiful syntax and fast compiled binaries is theoretically compelling. Swift is probably the biggest competitor aesthetics wise with this combination. Compiled to wasm (very early days), crystal apps are an order of magnitude smaller than swiftwasm's 4.4-7.5 MB. Both feel incomplete in their ecosystem, fear of future abandonment is real. Something like rails with server and client code in crystal would be a banger, similar to (bloated) Blazor. It would be nice if they could find a way to serialize compilation intermediates to allow incremental compilation!

👤 d_sc
The language is really nice, the compatibility with the Ruby language is impressive. It’s incredibly fast, uses a tiny amount of memory and it’s binaries are very small. For web development, the Lucky framework by Thoughbot is promising.

Personally my biggest issue is the compile times. For web app development where you may be saving frequently and using hot reloading it’s to slow, it’s lagging.

If non-production compile times were reduced by 60-80% I could envision interest and adoption increasing quickly.


👤 javajosh
Every programming language needs to confront the fact that it's distribution, not syntax, that matters, and nothing else. And JavaScript won distribution. By a landslide. There are many lovely languages out there, and you can certainly describe your personal processes or even your server processes with them, but ultimately you will be limited by ad hoc and brittle distribution systems, and their adoption will reach some small asymptote.

👤 mooreds
Had someone give a talk on crystal at the Boulder Ruby meetup a few years ago. It seemed really interesting if you wanted to build CLI apps and liked the mouthfeel of the ruby language.

What was missing at the time was the equivalent of the gem ecosystem. I'm not sure if that has changed.

Here's the talk if you are interested: https://www.youtube.com/watch?v=B6Hx5wgNFL0


👤 arunix
It's unfortunate that Ruby's import semantics hasn't been improved upon by Crystal, i.e. you can only import all definitions from a file - no selective imports like with Python and many other languages (even Perl gets this right).

👤 Tolexx
I will say it's more like statically typed Ruby. It has many frameworks for building web applications of which the most popular seems to be Amber.

Unfortunately it has a small community. For instance in my opinion one would rather build a web application using ruby than crystal. The only ruby-like language that has gained some level of success and popularity is elixir.


👤 helen___keller
I really enjoy it because I already knew Ruby (so the syntax didn’t bother me) and the type system, in particular algebraic types, was to my liking.

That said it might as well be a toy language, in my opinion, because I don’t think it has the support or community to power a serious production project


👤 Mikeb85
Honestly Nim is more mature, has more features, compiles quicker and is equally easy. Crystal has nice syntax but otherwise is lacking features.

👤 rvz
> If you are using Crystal, or have taken a look at the language, what are you thoughts on the language?

Maybe ask Nikola Corporation? [0]

[0] https://manas.tech/blog/2020/02/11/nikola-motor-company/


👤 Parker_Powell
Crystal is one of the languages that I have been learning. I like it because it has a Ruby-like syntax and it is statically typed.

It has a Ruby-like syntax but performance is better than Ruby. The creators of this language say that in many cases the speed will be close to C++. Also, programmers who know Ruby will not have much problem using Crystal.

The language is still in development but I think that it has a future. Another important thing is that the community around this language is growing very fast and there are many jobs for developers who know this language.

I think that Crystal could be another option for languages such as Java and C# because it has similar features like static typing, compiles to native code, etc. The tooling is a little bit rough around the edges, but I think that's to be expected for a language that's only been around for three years. The community seems really active and helpful, though, and I have no doubt that these tools will improve over time as the language develops.

I recommend Crystal to anyone who's had trouble with Ruby's speed or who wants more type information available. Definitely check it out!