A Programming Language for Humans and Computers

Creator Ary Borenszweig started Crystal in 2011, and was quickly joined by Juan Wajnerman, Brian Cardiff, and the whole team from the Argentinian company Manas Technology Solutions.[7] It’s now also carried by a complete open source development on GitHub, with over 250 contributors.

At the time of this writing, Crystal is currently at v 0.27.0. A steady effort to reach the v1.0 production version is ongoing, but a strong and welcoming community already supports Crystal’s growing popularity. A Ruby-like compiled language—sounds attractive, right?

It’s much easier to program at a lower level in Crystal than it is in Ruby, and Crystal executes much faster. That’s why its name contains the letter “C”—a reference to its native character. In addition to its strong Ruby roots, Crystal also seeks inspiration from other contemporary languages like Rust, Go, C#, Python, Julia, Elixir, Erlang, and Swift. It mixes the best features of its predecessors in a way that no other language does.

Crystal combines the syntax and many idioms from Ruby with:

  • A static type system where types are mostly automatically inferred.

  • Automated garbage collection that makes the language memory safe.

  • Compilation to machine code through the LLVM toolchain for speed, with emphasis on a low memory footprint.

  • A macro-system of compile-time evaluation that provides much of the flexibility of Ruby’s dynamic approach but with no performance penalty.

  • Full object-orientation: everything is an object in Crystal.

  • Support for generics as well as method and operator overloading.

  • Scalability and concurrency, implemented with a cooperative, lightweight, and easier to understand threading model called fibers. (Fibers are inspired by the communicating sequential processes, or CSP, architecture that you also see in Go.)

Crystal aims to be cross platform, supporting Linux, macOS, and FreeBSD for both x86/64 (64-bit) and x86 (32-bit) architectures. It also has ARMv6/ARMv7 support. Core team members actively work on a Windows port. Crystal is also self-hosting: its compiler is written in Crystal itself, making it easier to see how Crystal works. The Crystal name says it all: more transparency. To contribute to the language, all you need to know is the language itself.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.122.82