Crystal - An Expressive Programming Language with Static Typing and Macros

Crystal - An Expressive Programming Language with Static Typing and Macros

Robbert Haarman

2013-01-06

Posted by inglorion
at 2015-09-09 20:24:17

Crystal is a programming language with syntax and expressiveness inspired by Ruby, but with static typing, macros, and an implementation that compiles programs to native code. Types are automatically inferred, so code can be written without type annotations, although annotations can be added to restrict the types accepted by methods or to implement ad-hoc polymorphism. Macros allow a fixed subset of the language to be used to transform source code, allowing metaprogramming without run-time overhead. Ruby programs can often be transformed to Crystal programs with small modifications.

There is a self-hosting implementation of Crystal, using LLVM to generate native code. An foreign function interface is available to allow Crystal code to call C code and vice versa.