Crystal (programming language)


Crystal is a high-level [programming language|high-level] general-purpose, object-oriented programming language, designed and developed by Ary Borenszweig, Juan Wajnerman, Brian Cardiff and more than 530 contributors. With syntax inspired by the language Ruby, it is a compiled language with static type-checking, but specifying the types of variables or method arguments is generally unneeded. Types are resolved by an advanced global type inference algorithm. Crystal
is currently in active development. It is released as free and open-source software under the Apache License version 2.0.

History

Work on the language began in June 2011, with the aim of merging the elegance and productivity of Ruby with the speed, efficiency, and type safety of a compiled language. Initially named Joy, it was quickly renamed to Crystal.
The Crystal compiler was first written in Ruby, but later rewritten in Crystal, thus becoming self-hosting,. The first official version was released in June 2014. In July 2016, Crystal joined the TIOBE index.

Description

Although resembling the Ruby language in syntax, Crystal compiles to much more efficient native code using an LLVM backend, at the cost of precluding the dynamic aspects of Ruby. The advanced global type inference used by the Crystal compiler, combined with union types, gives it more the feel of a higher-level scripting language than many other comparable programming languages. It has automated garbage collection and offers a Boehm collector. Crystal possesses a macro system and supports generics as well as method and operator overloading. Its concurrency model is inspired by communicating sequential processes and implements lightweight fibers and channels, inspired by Go.

Adoption

In 2020, it was reported that the infotainment units in vehicles produced by Nikola Corporation were written in Crystal. Much of the backend of the Kagi search engine is written with Crystal.