Crystal 0.13.0 has been released!
This release includes some compiler and standard library fixes, as well as a bunch of additions. Let’s see some of them.
Special handling of case with tuple literals
There’s now special language support for matching multiple values. For example, FizzBuzz
can now be written like this, using an underscore (
_) to match any value:
With this new syntax you can also match types, and variables inside a
when body are known
by the compiler to have those types:
Backreferences in sub and gsub
String#gsub now feature a syntax for backreferences, similar to Ruby’s.
To implement this,
gsub does a quick check to see if the string has any backlash in it. If so,
for every match it will scan the string for backreferences. The quick check would make existing
code slower. However, most of the cases the replacement string is known at compile-time, so that
check disappears in release mode, thanks to LLVM.
Custom separator and quote for CSV
The separator and quote field for parsing CSV can now be specified at construction time, thanks to jreinert:
Now you can generate a random float between 0 and
max, or between a given float range,
thanks to AlexWayfer:
Be sure to read the full changelog, as there are more additions, small changes, bug fixes and optimizations.