A Quick Dive into the Crystal Programming Language


#1

You might have heard mentions of the Crystal programming language of late. It is a language that looks very similar to Ruby. In fact, many Ruby programs are also valid Crystal programs. However, it must be emphasized that this is a mere side effect of the syntax of the language and is not a goal of the project.

One of the most interesting things about Crystal is that it is a statically type-checked language, yet it doesn’t require the programmer to sprinkle types everywhere like Java. Crystal compiles down to efficient code, which means Crystal programs are much faster than Ruby programs.

In this article we will take a quick dive into Crystal. This is by no means a comprehensive walk-through of all the features in Crystal. Instead, we are going to develop a concurrent Chuck Norris joke fetcher with the lens of a Rubyist. This involves making HTTP GET requests and also some JSON parsing.

We will see how far that takes us, along with looking into the facilities that Crystal provides that makes things more convenient.

By Benjamin Tan Wei Hao (Author of The Little Elixir and OTP Guidebook and The Ruby Closures Book)


#2

Very interesting. Thanks for sharing.