We are releasing the first post-1.0 release, making efforts to keep our promise of making regular releases each 3 months, a bit delayed because of the conference, and with special focus on keeping the language stability. Below we list the most important or interesting changes, without mentioning the several bugfixes. For details visit the release’s notes.
In this release we included 166 PRs since the 1.0.0 release by 28 contributors. We thank all the effort put into improving the language and its stdlib! ❤️
Splats can now be embedded in enumerable literals and in type definitions (#10429). A few examples:
The type of a while expression is now the union of all break expressions within the body, plus
Nil if the condition isn’t exactly the
true literal; the while expression returns
nil if the condition fails. The type of a break expression is computed similarly to a break inside a block or a return (
Nil if empty,
Tuple if multiple values) (#10566).
It is now possible to access the top level module with the special instance variable
NumberLiteral now includes a
to_number method to obtain the pure number, without any stringification #10802:
We included a small breaking change, as there was a mismatch between the documentation and the code regarding
Path#global?. The former
Path#global is now deprecated in favor of
Path#global?, whose name better represents it (#10812).
There were several changes that are not supposed to have a direct impact on the users. The most important one to note is that to help get better error messages and documentation, several methods were annotated with expected types. Adding typing annotations might break existing code in specific scenarios so, if this happens to you, please let us now. Also, we are growing the native Windows support, requiring several refactors.
It is now possible to create numbers from different representations using
new, as in
Float32.new("1.1", whitespace:false) ((#10422).
#negative? methods for
Hash class includes now sub/superset checking methods (#7500):
Hash#subset_of?(other : Hash)
Hash#proper_subset_of?(other : Hash)
Hash#superset_of?(other : Hash)
Hash#proper_superset_of?(other : Hash)
Finally, it is now possible to
Array, to efficiently remove elements from both ends (#10712).
New methods for getting peer certificates and signatures in
Now it is possible to use a
Path for the methods in
OAuth2::Client supports the customization of its
HTTP::Client node (10452).
The segfault handler is now implemented in Crystal, in practice meaning that the compilation process of Crystal is simpler: it does not require the former external
libcrystal. For package maintainers, this means building
libcrystal.a (which was part of the
make deps recipe) is obsolete now. The C code for this library has been removed and packaging instructions need to be updated.
make deps is no longer necessary for building arbitrary Crystal programs; now it only builds
llvm_ext.a, only required for linking against LLVM (for example when building the compiler itself).
The Yaml parser now supports
We have been able to do all of this thanks to the continued support of 84codes, Nikola Motor Company and every other sponsor. To maintain and increase the development pace, donations and sponsorships are essential. OpenCollective is available for that. Reach out to firstname.lastname@example.org if you’d like to become a direct sponsor or find other ways to support Crystal. We thank you in advance!