I haven’t had a chance to follow Crystal much lately, so wondering how it’s doing. Any of you using it? Played around with it recently? What do you think? Where do you think it’s heading?
Sometime soon I’ll respond properly. I translated a Ruby gem to a Crystal shard so I’ve learned some things. More later.
Quick update. I’ll have finished writing a blog post this Monday and it should be out within two weeks.
I’ve been translating Arel to Crystal and I think that’s almost ready.
But one thing I think people will love is I’ve made a Crystal Rails Template. I haven’t written the M for the MVC yet though. Some would say that it’s better that way. Basically I’m abstracting away Kemal for the familiar Rails environment.
Now that I posted this I see in another thread there is a Rails like framework called Frost . Although it hasn’t been worked on in a year and doesn’t work anymore with current Crystal versions. Still this is a great learning experience.
Alright the blog post is scheduled for the 25th. But I’d like to give some general answer to the question the thread has.
“How’s Crystal coming along?”
It’s pretty amazing actually. Being able to write a website quickly and host it on Heroku is quite rewarding! Most everything is lacking in documentation though so you may end up re-inventing the wheel a few times.
For example there isn’t anything in the Kemal documentation on how to get the parameters from a posted form from a hash like object. When I took that data and wrote it right into my webpages view it display as an unparsed string so I thought that’s what it was. So I wrote Keyer to parse it. And when I proposed adding it into Kemal I was told, why not use
env.params.query … which I then inspectect with the
typeof macro and found I had wasted my time.
It’s surprising the kind of mature projects that exist in it. A fully compatible Sidekiq background job tool exists and can interact with Ruby’s Sidekiq jobs without any issues. There’ a DB tool that I like that I’ve been helping out on called Topaz which feels a lot like working with Rails’ models. Validations aren’t part of it yet but another person has written an excellent Rails-like validations shard called Accord.
I’m currently writing an API using Crystal and I’ll be having CoffeeScript on the front end… fun fun!
Now the language isn’t mature. I’ve run into a few keywords/macros such as
nil? when translating Arel from Ruby to Crystal. And
select is for threading in Crystal which hasn’t been finished yet Add select keyword by asterite · Pull Request #3130 · crystal-lang/crystal · GitHub . Seeing how Frost went into abandonware I’d say that it would be wise to avoid parts of the language that’ll make big changes for now.
I’ve translated several of my Ruby gems over to Crystal. See:
Although on the latter I found strings immutable so I had to remove half of the methods.
So I’m very happy with where Crystal has matured to! But there are still pot-holes in the road so look-out!
Oh! I’d be remiss if I didn’t mention Minitest!
The blog post is finally released! Crystal from a Rubyist’s Perspective