1. Read First (general) - nob-suz/crystal GitHub Wiki
This Page shows general introduction of Crystal programming Language(Crystal-lang). Contents are originally collected by myself,at first I made pages for Japanese,after that ,I translate to English (2015/5/4: You are more than welcome to translate Crystal documentation and wiki pages to Japanese.-Ary Borenszweig )
Newest Repository is in manastech/crystal.Please refer that.
documentation for the Crystal programming language
[Standard library API] (http://crystal-lang.org/api/)
This standard API document is generated according through Library source code comments written in markdown. Markdown Parser written in crystal is generating document.
#Introduction
Crystal programming Language has been originally developped by Manas Tech Corp. The Goal is to make Ruby-like fast&compiled Language Specifications and true Compiler and Libraries itself. And from the first ,opened on GitHub.
First commit was September 2012. In the first stage compiler was developped by Ruby language. After that release,compiler was gradually rewritten in subset of Ruby,and finally in Nov. 2013 ,Crystal compiler was self-hosted by Crystal compiler itself. Compiler scale is almost 30kloc and Standard Lib is almost 20kloc to 30kloc. Compiler compiles itself in almost 10sec including Garbage collection and Type inference(Global)
The Goal that,Ruby inspired syntax (and similar as possible) with Static-Typed but Type-inferred have the advantage of debugging message at compile time from type system,and performance is closer to C-language,is at reality now.
For C-langauge object binding,Type declaration is possible and less overhead(boilerplate) is a big priority. LLVM is adopted via generating binaries,Types supported in LLVM is possible,and it is possible to see LLVM assembler list for debugging. Multicore is also supported in LLVM,so Crystal compiles for X86 multicore (defact is 8Core at --release mode)
[(The LLVM Compiler Infrastructure)] (http://llvm.org/)
Types we can handle ,are described in 、[Public Documents of crystal-lang.org] (http://crystal-lang.org/docs/syntax_and_semantics/literals.html)
To realize Static-Typed but Type-inferred, groval Type Inference is adopted. That means ,when compile user application, compiler parse all libraries required,and infer types. For example,if inference judge the property of int64 needed instead if int32,the type of variable becomes to int64,that is like Dynamic Type at Compile-Time.
It's important objective to reuse of Ruby eco-system,TDD(Test Driven Development) and BDD(Behavior Driven Development) is respected,so subset of Rspec is embedded in compiler itself from first stage.
And By adopting Markdown to source code comment,Standard Library APIis timely revised.
And GitHub is a defact tool(repositry) for Open-Source-Project right now,There are some functions like Crystal Init,which make a application/Library Project template on GitHub.
CrystalShards was developed and helped community for establishing Crystal eco-system,
CrystalShardswittertwittes the update of GitHub eco-system for Crystal.
That was developped by Crystal language.
These strong characteristics of Crystal language (its the same Ruby characteristics) have making so-named Crystal-eco-system.
Developpers are respecting recent popular programming languages, such as Go,Rust,Nim(rod),Julia,Erlang,of course Ruby itself. And try to implement in Crystal.
Try it online!
[play.crystal-lang.org] (http://play.crystal-lang.org/#/cr)
#Type system additional info. One of the unique characteristic of Crystal language is Type System(Type Inference). There are twitting Guys as follows
・Duck typing in a compiled language & compile time dynamism/meta programming capabilities
・Agressive Type Inference than Haskell, but faster compile than Rust.
・Algebraic Type system
・Crystal is a new programming language that focuses on developer productivity, type safety and execution performance. It is statically checked and compiles to native (machine) code. It combines a global type inference algorithm, compile-time macros, compile-time type introspection, automatic union types and Ruby-like syntax, allowing quick prototyping and generating efficient computer programs.