You are not logged in.

#1 2015-02-24 18:12:44

anatolik
Developer
Registered: 2012-09-27
Posts: 458

Crystal: like Ruby but natively compiled

I would like to share with community a piece of software gem that I recently discovered. Meet Crystal language:

https://github.com/manastech/crystal
https://aur.archlinux.org/packages/crystal/

And to get taste of the languge here is a simple "Hello HTTP server" application:

require "http"

server = HTTP::Server.new(8000, HTTP::StaticFileHandler.new("."))
server.listen

This is a basic web server that serves content from the local directory.

At the first glance the code looks a lot like Ruby. But under the hood this language uses clever LLVM tricks to compile small and fast native binary without heavy dependencies to language runtime/virtual machine. This language adds some amount of static-type checking and it lets compiler to optimize the code more aggressively.

Let's compile the example
$ crystal build server.cr

And it shows that HTTP server with SSL/compression support is only 90K in size and no heavy dependencies. As for me this looks impressive.

I am active Ruby user and I always wanted more speed improvement, ideally output application should be fast native binary. And Crystal language fills this gap. I am going to try Crystal for my next console application to understand the language better but so far it looks very good to me. The project codebase is clean, project authors are smart developers and know what they are doing.

Last edited by anatolik (2015-02-24 18:32:09)


Read it before posting http://www.catb.org/esr/faqs/smart-questions.html
Ruby gems repository done right https://bbs.archlinux.org/viewtopic.php?id=182729
Fast initramfs generator with security in mind https://wiki.archlinux.org/index.php/Booster

Offline

#2 2015-02-24 18:27:22

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Crystal: like Ruby but natively compiled

Neat. I think this world needs more high level (Python, Ruby...) fully compiled languages. smile

Offline

#3 2015-08-26 19:30:31

anatolik
Developer
Registered: 2012-09-27
Posts: 458

Re: Crystal: like Ruby but natively compiled

Good news everyone. Crystal language package has been promoted to the official Arch repository. Now you can install it even easier than before. Just run

# pacman -S crystal


Read it before posting http://www.catb.org/esr/faqs/smart-questions.html
Ruby gems repository done right https://bbs.archlinux.org/viewtopic.php?id=182729
Fast initramfs generator with security in mind https://wiki.archlinux.org/index.php/Booster

Offline

Board footer

Powered by FluxBB