crystal v0.32.0 Release Notes
Release Date: 2019-12-11 // over 4 years ago-
Language changes
- ๐ Allow boolean negation to be written also as a regular method call
expr.!
. (#8445, thanks @jan-zajic)
Macros
- โ Add
TypeNode#class_vars
to list class variables of a type in a macro. (#8405, thanks @jan-zajic) - โ Add
TypeNode#includers
to get an array of types a module is directly included in. (#8133, thanks @Blacksmoke16) - Add
ArrayLiteral#map_with_index
andTupleLiteral#map_with_index
. (#8049, thanks @Blacksmoke16) - โ Add docs for
ArrayLiteral#reduce
. (#8379, thanks @jan-zajic) - โ Add
lower:
named argument toStringLiteral#camelcase
. (#8429, thanks @Blacksmoke16)
Standard library
- (breaking-change) Remove
Readline
from std-lib. It's now available as a shard at crystal-lang/crystal-readline (#8364, thanks @ftarulla) - ๐ Move
Number#clamp
toComparable#clamp
. (#8522, thanks @wontruefree) - ๐ Allow
abort
without arguments. (#8214, thanks @dbackeus) - ๐ Improve error message for not-nil assertion in getters. (#8200, #8296, thanks @icy-arctic-fox)
- โ Add
Enum.valid?
. (#5716, thanks @MakeNowJust) - Disable colored output if
TERM=dumb
. (#8271, thanks @ilanpillemer) - ๐ Documentation improvements. (#7656, #8337, #8446, thanks @r00ster91, @vlazar, @cserb)
- โ Add docs for pseudo methods. (#8327, #8491, thanks @straight-shoota)
- Code cleanups. (#8270, #8368, #8404, thanks @asterite, @vlazar, @arcage)
Numeric
- ๐ Fixed
%
andInt#remainder
edge case of min int value against-1
. (#8321, thanks @asterite) - ๐ Fixed
Int#gcd
types edge case and improve performance. (#7996, #8419, thanks @yxhuvud, @j8r) - โ Add
Int#bits
for accessing bit ranges. (#8165, thanks @stakach) - ๐ Allow
Number#round
withUInt
argument. (#8361, thanks @igor-alexandrov)
Text
- (breaking-change) Implement string interpolation as a call to
String.interpolation
. (#8400, thanks @asterite) - (breaking-change) Deprecate
String#codepoint_at
, usechar_at(index).ord
. (#8475, thanks @vlazar) - ๐ Fixed encoding specs for musl iconv. (#8525, thanks @straight-shoota)
- โ Add
String#presence
. (#8345, #8508, thanks @igor-alexandrov, @Sija) - โ Add
String#center
. (#8557, thanks @hutou) - ๐ (performance) Refactor
String#to_utf16
optimizing for ascii-only. (#8526, thanks @straight-shoota) - โ Add docs in
Levenshtein
module. (#8386, thanks @katafrakt) - โ Add docs to
Regex::Options
. (#8448, thanks @jan-zajic)
Collections
- (breaking-change) Deprecate
Enumerable#grep
, useEnumerable#select
. (#8452, thanks @j8r) - ๐ Fixed
Enumerable#minmax
,#min
,#max
for partially comparable values. (#8490, thanks @TedTran2019) - ๐ Fixed
Hash#rehash
. (#8450, thanks @asterite) - ๐ Fixed
Array
range assignment index out of bounds. (#8347, thanks @asterite) - ๐ Fixed endless ranged support for
String#[]?
andArray#[]?
. (#8567, thanks @KarthikMAM) - Add
Hash#compare_by_identity
andSet#compare_by_identity
. (#8451, thanks @asterite) - Add
Enumerable#each_cons_pair
andIterator#cons_pair
yielding a tuple. (#8332, thanks @straight-shoota) - Add
offset
argument to allmap_with_index
methods. (#8264, thanks @asterite) - ๐ (performance) Optimized version of
Tuple#to_a
. (#8265, thanks @asterite) - โ Add docs to
Hash.merge!(other : Hash, &)
. (#8380, thanks @jan-zajic) - โ Add docs to
Hash.select
. (#8391, thanks @jan-zajic) - โ Add docs and specs to
Enumerable.reduce
. (#8378, thanks @jan-zajic)
Serialization
- (breaking-change) Make
XML::Reader#expand
raise, introduceXML::Reader#expand?
for former behavior. (#8186, thanks @Blacksmoke16) - ๐ Allow
JSON.mapping
&YAML.mapping
converter attribute to be applied toArray
andHash
. (#8156, thanks @rodrigopinto) - Add
use_json_discriminator
anduse_yaml_discriminator
to choose type based on property value. (#8406, thanks @asterite) - Remove return type
self
restriction fromObject.from_json
andObject.from_yaml
. (#8489, thanks @straight-shoota)
Files
- (breaking-change) Remove expand home (
~
) by default inFile.expand_path
andPath#expand
, now opt-in argument. (#7903, thanks @didactic-drunk) - Fixed bugs in
Path
regarding#dirname
,#each_part
,#each_parent
. (#8415, thanks @jan-zajic) - ๐ Fixed
GZip::Reader
andGZip::Writer
to handle large data sizes. (#8421, thanks @straight-shoota) - ๐ Fixed
File::Info#same_file?
by providing access to 64 bit inode numbers. (#8355, thanks @didactic-drunk)
Networking
- ๐ Fixed
HTTP::Response#mime_type
returnsnil
on emptyContent-Type
header. (#8464, thanks @Sija) - ๐ Fixed handling of unidirectional SSL servers hang. (#8481, thanks @rdp)
- โ Add
HTTP::Client#write_timeout
. (#8507, thanks @Sija) - โก๏ธ Updated mime type of
.js
files totext/javascript
and includeimage/webp
. (#8342, thanks @mamantoha) - ๐จ Refactor websocket protocol GUID string. (#8339, thanks @vlazar)
Crypto
- (breaking-change) Enforce single-line results of
OpenSSL::DigestBase#base64digest
viaBase64.strict_encode
. (#8215, thanks @j8r)
Concurrency
- ๐ Fixed
Channel
successful sent and raise behavior. (#8284, thanks @firejox) - ๐ Fixed
Channel#close
to be thread-safe. (#8249, thanks @firejox) - ๐ Fixed
select
withreceive?
and closed channels. (#8304, thanks @bcardiff) - Faster
Mutex
implementation and policy checks. (#8295, #8563, thanks @waj, @ysbaddaden) - ๐ (performance) Channel internals refactor and optimize. (#8322, #8497, thanks @firejox, @Sija)
- โ Add docs to
Channel#send
andChannel#close
. (#8356, thanks @lbarasti) - Fixed
Thread#gc_thread_handler
for Windows support. (#8519, thanks @straight-shoota)
System
- ๐ฆ Don't close pipes used for signal handlers in multi-thread mode. (#8465, thanks @waj)
- ๐ Fixed thread initialization on OpenBSD. (#8293, thanks @wmoxam)
- Implement fibers for win32. (#7995, #8513, thanks @straight-shoota, @firejox)
โ Runtime
- Fixed fiber initialization on
-Dgc_none -Dpreview_mt
. (#8280, thanks @bcardiff) - โ Add GC profiling stats and warning bindings. (#8281, thanks @bcardiff, @benoist)
- ๐จ Refactor
callstack_spec
. (#8308, #8395, thanks @straight-shoota, @Sija)
Spec
- ๐ Fixed
--fail-fast
behaviour. (#8453, thanks @asterite) - โ Add before, after, and around hooks. (#8302, thanks @asterite)
- Restrict the type returned by
should_not be_nil
and others. (#8412, thanks @asterite) - โ Add ability to randomize specs via
--order random|<seed-value>
. (#8310, thanks @Fryguy) - โ Add specs for
Spec
filters. (#8242, thanks @Fryguy) - โ Add ability to tag specs. (#8068, thanks @Fryguy)
Compiler
- ๐ Fixed musl libc detection (Alpine 3.10 regression bug). (#8330, thanks @straight-shoota)
- ๐ Fixed pragmas handling in macros. (#8256, thanks @asterite)
- ๐ Fixed parser crash for 'alias Foo?'. (#8282, thanks @oprypin)
- ๐ Fixed parser error on newline before closing parenthesis. (#8320, thanks @MakeNowJust)
- ๐ Fixed generic subtypes edge cases triggering
no target defs
error. (#8417, thanks @asterite) - ๐ Fixed cleanup of local vars reachable by macros. (#8529, thanks @asterite)
- โ Add support for LLVM 9. (#8358, thanks @RX14)
- โ Add
--mcmodel
option to compiler. (#8363, thanks @ffwff) - Disallow
instance_sizeof
on union. (#8399, thanks @asterite) - โ Add mention to
crystal <command> --help
in help. (#3628, thanks @rdp) - ๐ Improve error message when a filename is misspelled. (#8500, thanks @rdp)
- ๐ Show full path of locally compiled Crystal. (#8486, thanks @rdp)
- Code cleanups. (#8460, thanks @veelenga)
Language semantics
- ๐ Fixed method lookup priority when type alias of union is used. (#8258, thanks @asterite)
- ๐ Fixed visibility modifiers in virtual types. (#8562, thanks @asterite)
- ๐ Fixed
sizeof(Bool)
. (#8273, thanks @asterite)
Tools
Formatter
- ๐ Fixed indent in arguments. (#8315, thanks @MakeNowJust)
- ๐ Fixed crash related to parenthesis on generic types. (#8501, thanks @asterite)
Doc generator
- ๐ Fixed underscore type restriction in doc generator. (#8331, thanks @straight-shoota)
- ๐ Correctly attach docs through multiple macro invocations. (#8502, thanks @asterite)
- ๐ Allow constants to use
:ditto:
. (#8389, thanks @Blacksmoke16) - โ Add sitemap generator. (#8348, thanks @straight-shoota)
- โ Add documentation for pseudo-methods:
!
,as
,nil?
, etc.. (#8327, #8371, thanks @straight-shoota) - โ Add clickable anchor icon next to headings. (#8344, thanks @Blacksmoke16)
- ๐ Use
&
instead of&block
for signature of yielding method. (#8394, thanks @j8r)
Playground
Others
- ๐ Allow boolean negation to be written also as a regular method call