published release of the programming language crystal 1.5 , the developers of which are trying to combine the convenience of developing Ruby with high application performance characteristic of the SI language. Crystal syntax is close to Ruby, but is not completely compatible with it, despite the fact that some Ruby programs are performed without processing. The compiler code is written in Crystal and is distributed under the license Apache 2.0. A clear indication of types of variables and arguments of the methods in the code. Crystal programs are compiled in executable files, with macros calculating and generating code during compilation. Crystal programs allow connecting binding written in SI. Code is parallelizing using the keyword “Spawn”, which allows you to launch the background task in asynchronous mode, without blocking the main stream, in the form of lightweight flows called Fiber (Fiber)..
The standard library provides a large set of standard functions, including the CSV, YAML, and JSON processing tools, components for creating HTTP servers and supporting WebSocket. In the development process, it is convenient to use the “Crystal Play” command that forms web interface (by default Localhost: 8080) for interactive execution of the code on Crystal.
The main changes :
- A correspondence check is added to the compiler
names of arguments in the implementation of the abstract method and in its definition. In case of inconsistency of names, a warning is now displayed: Abstract Class Fooabstract Abstract Def Foo (Number: Int32): Nil End Class Foo - When appropriating the argument of the atypical method of the variable value, this argument is now limited to the type of this variable. Class Foo @x: Int64 Def Initialize (x) @x = x # Parameter X will receive the type @x end end
- It is allowed to add annotations to the parameters of methods or macros. Def Foo (@[Maybeunused] X); end # ok
- Added support for the use of constants as indices and names in the motorcade. Key = “s” foo = {s: “string”, n: 0} puts foo [key] .Size
- In the API File, new methods File#Delete? and DIR#DeLETE? , returning false in the absence of a file or catalog.
- The protection of the File.TEMPFILE method is strengthened, which now does not allow zero symbols in the drains that form the name of the file.
- added the environment variable no_color, turning off the color release in the output of the compiler and the interpreter.
- Significantly improved work in the interpreter mode.