crystal v0.31.0 Release Notes
Release Date: 2019-09-23 // over 4 years ago-
Language changes
- ๐ Allow non-captured block args with type restriction using
& : T -> U
. (#8117, thanks @asterite)
Macros
Standard library
- (breaking-change) Remove
Markdown
from the std-lib. (#8115, thanks @asterite) - (breaking-change) Deprecate
OptionParser#parse!
, useOptionParser#parse
. (#8041, thanks @didactic-drunk) - ๐ Fix example codes in multiple places. (#8194, thanks @maiha)
Numeric
- (breaking-change) Enable overflow by default. (#8170, thanks @bcardiff)
- (breaking-change) Make
/
the arithmetic division for all types. (#8120, thanks @bcardiff) - Add
BigDecimal# **
andBigRational#**
(pow operator). (#7860, thanks @jwbuiter) - ๐ป Avoid overflow exception in
Number#round(digits, base)
. (#8204, thanks @bcardiff) - ๐จ Refactor
Int#divisible_by?
for clarity. (#8045, thanks @yxhuvud)
Text
- ๐ (performance) Minor
String#lchop?
ASCII-only optimization. (#8052, thanks @r00ster91)
Collections
- ๐ (performance) Array optimizations for small number of elements. (#8048, thanks @asterite)
- ๐ (performance) Optimize
Array#*
. (#8087, thanks @asterite) - ๐ (performance) Hash now uses an open addressing algorithm. (#8017, #8182, thanks @asterite)
- ๐ (performance) Optimize
Hash#to_a
,Hash#keys
andHash#values
. (#8042, thanks @asterite) - ๐ (performance) Add
Hash#put
and optimizeSet#add?
. (#8116, thanks @asterite) - ๐ Fixed
Slice#==
for some generic instantiations, addSlice#<=>
. (#8074, thanks @asterite) - โ Add docs on idempotence and methods involving eager evaluation in
Iterator
. (#8053, thanks @KimBurgess) - โ Add
Set#+
. (#8121, thanks @sam0x17) - ๐จ Refactor
Hash
to use integer division instead of float division. (#8104, thanks @asterite)
Serialization
- (breaking-change) Rename
XML::Type
toXML::Node::Type
, introduceXML::Reader::Type
. (#8134, thanks @asterite) - ๐ Fixed JSON and YAML parsing of
NamedTuple
with nilable fields. (#8109, thanks @asterite) - ๐ Fixed YAML to emit unicode characters as such. (#8132, thanks @asterite)
- ๐ Fixed INI generation of empty sections. (#8106, thanks @j8r)
Files
- ๐ (performance) Optimize
Path#join
by precomputing capacity if possible. (#8078, thanks @asterite) - ๐ (performance) Optimize
Path#join
for the case of joining one single part. (#8082, thanks @asterite) - ๐ (performance) Optimize
Dir.glob
. (#8081, thanks @asterite) - ๐ Fixed
File.basename
off-by-one corner-case. (#8119, thanks @ysbaddaden) - ๐ Fixed unneeded evaluation of
Path.home
onPath.expand
. (#8128, thanks @asterite) - ๐ Fixed
Zip::Writer
STORED compression. (#8142, thanks @asterite) - ๐ Fixed missing check on
ARGF
if read_count is zero. (#8177, thanks @Blacksmoke16)
Networking
- (breaking-change) Replace
HTTP::Server::Response#respond_with_error
with#respond_with_status
. (#6988, thanks @straight-shoota) - (breaking-change) Handle too long URIs and too large header fields in
HTTP::Request.from_io
and removeHTTP::Request::BadRequest
. (#8013, thanks @straight-shoota) - ๐ Fixed memory leak from
SSL_new
ifssl_accept
fails. (#8088, thanks @rdp) - ๐ Fixed WebSocket ipv6 hostname connection. (#8066, thanks @MrSorcus)
- โ Add
URI#query_params
method. (#8090, thanks @rodrigopinto) - โ Add
URI#resolve
andURI#relativize
. (#7716, thanks @straight-shoota) - โ Add
#clear
,#delete
, and#size
methods toHTTP::Cookies
. (#8107, thanks @sam0x17) - ๐จ Refactor
http/server_spec
. (#8056, thanks @straight-shoota) - ๐จ Refactor UDP specs to use random port. (#8139, thanks @waj)
Concurrency
- Multithreading. (#8112, thanks @waj)
- Delay releasing of fiber stack in multi-thread mode. (#8138, thanks @waj)
- โฑ Make
Crystal::Scheduler.init_workers
block until workers are ready. (#8145, thanks @bcardiff) - ๐ Make
Crystal::ThreadLocalValue
thread-safe. (#8168, thanks @waj) - Let
exec_recursive
use a thread-local data structure. (#8146, thanks @asterite) - โ Add explicit return types for some channel methods. (#8161, thanks @Blacksmoke16)
- โ Remove the dedicated fiber to run the event loop. (#8173, thanks @waj)
- ๐ Fix corruption of thread linked list. (#8196, thanks @waj)
- โช Workaround compile on win32 until fibers is implemented. (#8195, thanks @straight-shoota)
System
Spec
- (breaking-change) Add support for
focus
. (#8125, #8178, #8208, thanks @asterite, @straight-shoota, @bcardiff)
Compiler
- ๐ Fixed ICE on declarations inside fun. (#8076, thanks @asterite)
- ๐ Fixed missing
name_location
of some calls. (#8192, thanks @asterite) - โ Activate compiler warnings by default. (#8171, thanks @bcardiff)
- ๐ Improve return type mismatch error. (#8203, thanks @asterite)
- ๐ Improve
for
expression error. (#7641, thanks @r00ster91)
Language semantics
- ๐ Fixed abstract def check regarding generic ancestor lookup. (#8098, thanks @asterite)
- ๐ Fixed missing virtualization of type arguments in
Proc
types. (#8159, thanks @asterite) - ๐ Fixed incorrect typing after exception handler. (#8037, thanks @asterite)
- ๐ Fixed behaviour when a yield node can't be typed. (#8101, thanks @asterite)
- ๐ Fixed
offsetof
on reference types. (#8137, thanks @mcr431) - ๐ Allow rescue var to be closured. (#8143, thanks @asterite)
- ๐จ Refactor class var and constant initialization. (#8067, #8091, thanks @waj)
- โ Add runtime check for recursive initialization of class variables and constants. (#8172, thanks @waj)
Tools
Doc generator
- ๐ Fixed link to constructors of another class. (#8110, thanks @asterite)
- ๐ Enable docs from previous def and/or ancestors to be inherited. (#6989, thanks @asterite)
Others
- ๐ Allow non-captured block args with type restriction using