Crystal is a general purpose, statically-typed, object-oriented, and compiled programming language coming from Manas Tech. The language has been in development since 2014 (for about 6 years now) and the most recent language version is 0.35.1. While everyone eagerly waits the official release of version 1.0 of Crystal, I came across this language and wanted to take a first look. This article is the result of that first look at Crystal for a few hours. Coming from Ruby/Rails and Elixir/Phoenix background, I felt naturally inclined to look at this Ruby like slick programming language.

Image for post

As mentioned on the github page of Crystal, the main motivation behind the language development being -

  • We love Ruby’s efficiency for writing code.
  • We love C’s efficiency for running code.
  • We want the best of both worlds.
  • We want the compiler to understand what we mean without having to specify types everywhere.
  • We want full OOP.

Oh, and we don’t want to write C code to make the code run faster.

In this article, I wanted to express my experience spending a few hours with Crystal and its ecosystem. I would thing the major audience of this language would be web developers coming from Ruby/Rails background. Due to my limited exposure, I will not cover any web framework in this article but there do exist some web frameworks already, most notable being -

Installing Crystal

It is possible to install Crystal on Mac OS using Homebrew using below commands —

$ brew update

$ brew install crystal

But I prefer to install using asdf version manager in case I need to install multiple versions for some reason. asdf has a plugin for Crystal — https://github.com/asdf-community/asdf-crystal

I used the below commands to install the plugin —

_$ asdf plugin-add crystal https://github.com/asdf-community/asdf-crystal.git --> _installs the plugin for asdf

_$ asdf install crystal 0.35.1 --> _installs Crystal 0.35.1

_$ asdf global crystal 0.35.1 --> _sets global version of Crystal as 0.35.

We can see the version of Crystal compiler installed using below command —

Image for post

#programming-languages #ruby #software-development #ruby-on-rails #crystal-lang

A First Look at Crystal Programming Language and it’s Ecosystem
1.75 GEEK