Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Anyone using Crystal in production? What do you use it for?


At BlockVue we use crystal for v2 of most of our core infrastructure (the old version of our app is Rails-based), and we also use crystal heavily in Google Cloud Functions via our gcf.cr (open source) tool. So mainly we use amber and gcf.cr in conjunction with one another. We host everything on Google App Engine and GCP.


We use Crystal at RainforestQA to replace our heavy-load / slowish Ruby microservices. It's been great so far and we love it. We're also increasing the adoption to Crystal inside the organization.

Also Crystal has a dedicated a wiki page for production users

Used in production: https://github.com/crystal-lang/crystal/wiki/Used-in-product...


Interesting! I’m surprised you didn’t move to Elixir given the syntax similarities to Ruby


While elixir's syntax is inspired by ruby, the semantics are vastly different. That change in semantics is really good for elixir, because it means it can take advantage of the unique properties of the erlang vm, but it's worth noting that crystal is far far closer to ruby than elixir. For better and for worse.


The syntax similarities between Elixir and Ruby stop as soon as one moves on from reading short blog post to writing real code. They are extremely different languages. Knowing Ruby helps only to remember the names of some standard library modules and functions, which were designed on purpose to match the name of the corresponding Ruby modules and methods, but not all of them. A vanilla example:

    $ iex
    > "1 2 3" |> String.split |> Enum.map(fn x -> String.to_integer(x) * 2 end)
    [2, 4, 6]

    $ irb
    > "1 2 3".split.map {|x| x.to_i * 2}
    [2, 4, 6] 
which by the way highlights the extra verbosity of Elixir compared to Ruby. It's less verbose on more complex examples, mainly because of pattern matching, but the proof would be too long for this reply.


Kotlin syntax:

"1 2 3".split(' ').map { it.toInt() }


Your example doesn't do the same thing.

The same as grandparent, in crystal:

  "1 2 3".split.map &.to_i.*(2)


I believe that Ruby also has that & shortcut (or similar) but it's totally unreadable. I never used it and I don't even want to check the exact syntax. Is it the only way it works in Crystal?


It being readable is a matter of getting used to it. I find it more readable than the block version as there is less syntactic boilerplate. YMMV.

Ruby has a similar version using colon instead of dot but that version isn't chainable and doesn't take arguments so it can't do the *2.

And no, you can write out the full block just as you did in the Ruby version.


Whoops, you're right.

    "1 2 3".split(' ').map { it.toInt() * 2 }


I hear this a lot but I keep seeing more and more Ruby devs moving to it trivially and as someone who reads-not-writes Ruby code I find it just as trivial to grok it.

So I think the differences are there but they’re being overstated from a transfer of skills standpoint.


Differences don't necessarily make it hard to move to another language. Many developers moved from Java to Ruby between 2006 and 2010, including me, and Ruby is pretty different.


Elixir would probably not have been a huge improvement over Ruby if they switched languages for performance reasons. Elixir is great for many things, but raw number-crunching performance is not one of them.


What drew you to Crystal?

If you'll forgive the snark, you've moved from one obscure language, to an even more obscure language that even fewer developers know.

What is it about Crystal that outweighs the very boring practical downsides of production use of obscure and immature languages?


How is Ruby an obscure language...?

Their developers are already proficient in Ruby. Crystal is a very, very close cousin of Ruby, syntactically and structurally. This isn't like jumping from Java to Haskell.


I didn't know it was that similar. Neat idea for a language.

The 'Boo' language does the same for Python.


I'd say Nim is for Python what Crystal is for Ruby.


On closer inspection I agree - hadn't realised Boo uses the Common Language Infrastructure.


>What is it about Crystal that outweighs the very boring practical downsides of production use of obscure and immature languages?

Tons of startups, and tons of billion dollar companies, run on Ruby / Rails. How is it "obscure"?

Crystal sure.

Then again, PG who created Hacker News used Common Lisp, which at the time had about the same developer pool as Crystal give or take (well, not really, but close enough, compared with industry favorite languages).


I think many tens-of-thousands of developers would not agree that Ruby is obscure.


In silicon valley and among most of the startup community, Ruby still dominates the landscape, even when compared with Node.js, Python, etc. There's plenty of talk of companies re-writing their infrastructure in node, but why would you do that when you can have Rails and/or Crystal? Furthermore, if you ever need something from NPM, you can just throw it in a Google Cloud Function or in Lambda.

https://medium.com/@yoelblum_45935/demand-for-ruby-on-rails-...


It's interesting that everyone's still using rails in silicon valley. Here in the UK, Laravel (PHP) and Django (python) are both more popular than Rails for new projects. But I hear that PHP isn't popular at all in the US?


PHP in the U.S., especially in the startup world, is seen as "oh, you develop in third world countries". That's the perception these days unfortunately.

That said, I was an avid PHP developer in the U.S. about 10-15 years ago and I always liked the language. There's just no one learning PHP anymore since all the kids just learn js, and no one trying out "hipster" languages like ruby/crystal/go/python/elixr/d/nim/rust/etc is going to try crusty old PHP.

I will say though that PHP, without any frameworks, is probably my favorite thing to develop a simple standalone site specifically because it lets you break all conventions and just output some damn content possibly with some simple logic involved and without using classes/mvc/etc.


Probably because they loved the language. Humans are humans, and not everything is made with a rational financial decision. If you use the language, and like ruby and static typing, you'll find that there's a lot to love.


I see your point, but I sympathise with it less and less as time goes on. Programming languages are just tools. Software development should strive to be a proper, rational, engineering discipline.

Humans aren't robots, but one's choice of development tools is steered by real forces, both technical and business. I don't see that whim, unconstrained by such forces, has any place in the decision. Same goes for curiosity.

If it were my decision to choose a language to use in production, I'd want to go with a safe boring choice like Python/Java. Mature and stable on lots of platforms, easy to hire for, plenty of libraries and tooling.

Taking a risk is sometimes the right thing to do, but I don't see choice of programming language as being one of those times.

It's not that I don't like neat languages like Crystal - I really do - and I'm certainly not trying to put them down. I just wouldn't want to try to argue to management that using it is in the company's best interest.


> Software development should strive to be a proper, rational, engineering discipline.

Well, to use an analogy from civil engineering, I don't think choosing a programming language is always as critical as which type of concrete you choose and how it's reinforced. While it's true you wouldn't choose just any language, there is more room for preference here. Especially because you can switch languages for a project, but practically can't switch the material used in the foundation of a building.

> I just wouldn't want to try to argue to management that using it is in the company's best interest.

In some companies you don't need to argue with management about that decision. Also, a language being less popular or obscure doesn't mean you can't evaluate it's stability and feel comfortable enough with where it's at to use it. I'm glad people do because otherwise we wouldn't even see any language as popular as it is.


> you can switch languages for a project

What do you mean? If you're 100kloc in, you pay a considerable price in jumping ship. Rewriting means throwing out your investment. Interfacing two different languages for one project is rarely a good move.

> I'm glad people do because otherwise we wouldn't even see any language as popular as it is.

Sure, me too. Like I said, I do like new programming languages, I just don't see myself using one for serious work.


It's always a tradeoff between having fun and accepted practice, and I'm glad for the brave souls who do use Crystal in production. After all, every mature language was once someone's toy, and you can never get from one to the other without many successive firsts.

I'm not here to recommend people use it in production, but I can understand the mindset of people who do.


>Software development should strive to be a proper, rational, engineering discipline.

That will never happen. Or when it did it will be all mechanized, with machines doing the programming.


Even today, a tiny proportion of software development is actually done with a respectable engineering process.

It's not a myth, and I don't see that it should be dismissed as a pipe-dream to think that this sort of serious engineering approach could be adopted outside the critical-systems industry.

https://www.fastcompany.com/28121/they-write-right-stuff


We're currently using Crystal 0.25.1 with the Kemal web framework to provide an online paycheck calculator for US based employees (it's basically a demo/tool for our SaaS based accounting, payroll and fund raising app).

Really impressed with the language so far and hope to expand its use within our organization.


I'm the creator of Kemal, glad to see that you're liking it :)


I'm planning on trying it to replace some Ruby code that updates our elasticsearch index in a background job. It's currently slow and memory hungry and crystal's similarity to Ruby should make it easy to port.


Let's make this more generic:

Anyone using Crystal? What do you use it for?


I do. I run a service called "HashCache" which caches resources by hash ( http://hashcache.rkeene.org/ ). I use this as a central cache for build scripts which download resources from the Internet, and the upstream/origin server may go away.

I wrote a version in Crystal (v0.10, I think) and Tcl to compare the two:

Crystal: https://chiselapp.com/user/rkeene/repository/hashcache/artif...

Tcl: https://chiselapp.com/user/rkeene/repository/hashcache/artif...


I'm specifically interested in production settings, not toy projects. Using something in production is much more interesting.


I am making a simple bloggy webapp with Crystal.


I'm not sure why anyone would actually use it in the current state, unstable, lack of libraries, lack of community and the biggest problem no multi-threading / windows support


I know you’re (effectively) trolling here, but there are many reasons to “actually” use it. The community is great and helpful (check out the Gitter activity if you have any question about that). Lack of Windows support (for now) doesn’t matter if....you don’t use Windows. Multi-threading is being worked on.

You’re rehashing the same 2 things many folks point out that Crystal is missing in its pre-1.0 state and while they’re obviously important for widespread adoption, they’re not reason in and of themselves to dismiss a language that’s otherwise super interesting to many.


Ruby is pretty useless on Windows too to be fair.

Good luck trying to compile native libraries.


I'm actually not trolling, I'm 100% serious, there is no reason to use that language right now when you have others languages that are better on every aspect. Maybe Crystal will be ready at some point but right now it's not.


I don't think any language feels as close as crystal does to dynamic languages while being completely type safe with strong types. I think thats why so many people choose to use it so early. It truly doesn't feel like any other language out there.


For the thrill man! If it doesn't have a library you need you create it yourself. Eventually enough people who have the skill to contribute will become interested in Crystal and contribute a library, then one day crystal will replace java. In all seriousness, other than the multithreaded windows support, which libraries are missing?


For sure. I've had a lot of fun getting to be the person to create some basic libraries for things like image manipulation and an ORM for mongodb when I find no one else has done that yet.

One big thing that is missing still is full google cloud platform and AWS libraries. There is an s3 connector but I think it's out of date.


We use it in production. The web framework side of crystal is IMO more mature than what you find in Node.js, Python, etc. About a year ago we tried moving everything to Express because it's super easy to find fledgling js developers, but Express simply lacked most of the features we needed, even when supplemented by npm, whereas Amber did everything we needed literally out of the box.

Edit: Sails is not what it claims to be, and doesn't live up to the dream at all


> Sails.js is probably the closest thing to sane in the JS web framework ecosystem

Whoa, that's where you lost me. Sails has a reputation for being horrible, and after working on a production app using Sails, I agree. Perhaps you were wanting something like Rails but in JS, which is what Sails claims to be, but it barely lives up to that. I don't know if there are other frameworks that try to be the Rails of JS but it wouldn't be hard to better than Sails. I'm interested in hearing why you think it's so sane (no snark, I'm sincerely curious)


I'm going to retract my statement about Sails. I had a lot of trouble with it when I went to use it, but I thought it was just me. It seems it really is crappy as well.


Why’s that?


You could basically say the same about any language. Just switch the descriptions. For example:

C#: verbose, magical dependency injection, Microsoft, etc.

Ruby: slow

Go: ugly syntax, verbose, if err != nil, etc.

If a language works for you I see no reason not to use it :-)


Ruby's getting much faster now with recent speed improvements, JIT and recent developments by the TruffleRuby team


Why would those who do use and are happy with it, judging from the responses here, not use it?




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: