Crystal 0.6.0 has been released!
This release contains several fixes to the language as a whole.
Function was renamed to
Proc, to match Ruby’s name, but also because it’s not just a
function: it can have an associated closure context, so the new name reflects that better.
It’s also shorter to write.
Tuple are now considered structs by the compiler, so to reopen them you
struct Pointer; ...; end. This doesn’t change anything, really, but makes everything
be consistent: structs are passed by value, classes are passed by reference. Both
Tuple are passed by value, so it makes sense for them to be structs.
Crystal retains a few magic variables from Ruby:
$~ (and the associated
$2, … variables) and
Although they are magical and might look cryptic at first, once you learn them they become a valuable tool
for writing short, readable code.
Before this release these variables were global, meaning that they were also not thread-safe. Starting
from this release they are method-local, defined by, for example,
can read the details of the implementation here.
Happy hacking! :-)comments powered by Disqus