Releases: crystal-lang/crystal
Releases · crystal-lang/crystal
0.36.0
Language changes
- (breaking-change) Reject annotations on ivars defined in base class. (#9502, thanks @waj)
- (breaking-change) Make
**
be right associative. (#9684, thanks @asterite)
Macros
- (breaking-change) Deprecate
TypeNode#has_attribute?
in favor of#annotation
. (#9950, thanks @HertzDevil) - Support heredoc literal in macro. (#9467, thanks @makenowjust)
- Support
%Q
,%i
,%w
, and%x
literals in macros. (#9811, thanks @toddsundsted) - Allow executing multi-assignments in macros. (#9440, thanks @makenowjust)
Standard library
- (breaking-change) Drop deprecated
CRC32
,Adler32
top-level. (#9530, thanks @bcardiff) - (breaking-change) Drop deprecated
Flate
,Gzip
,Zip
,Zlib
top-level. (#9529, thanks @bcardiff) - (breaking-change) Drop deprecated
with_color
top-level method. (#9531, thanks @bcardiff) - (breaking-change) Make
SemanticVersion
parsing more strict. (#9868, thanks @hugopl) - Respect explicitly provided type vars for
Tuple.new
andNamedTuple.new
. (#10047, thanks @HertzDevil) - Fix
OptionParser
to handle sub-commands with hyphen. (#9465, thanks @erdnaxeli) - Fix
OptionParser
to not call handler if value is given to none value handler. (#9603, thanks @makenowjust) - Make
def_equals
compare first by reference. (#9650, thanks @waj) - Remove unnecessary
def ==(other)
fallbacks. (#9571, thanks @makenowjust) - Fix
OptionParser
indentation of option descriptions. (#10183, thanks @wonderix) - Add
#hash
toLog::Metadata
,Path
,SemanticVersion
,Socket::Address
,URI::Params
, andUUID
. (#10119, thanks @straight-shoota) - Refactor several
case
statements with exhaustivecase
/in
. (#9656, thanks @Sija) - Remove
Kernel
mentions in docs. (#9549, thanks @toddsundsted) - Improve docs for
Object#dup
. (#10053, thanks @straight-shoota) - Fix example codes in multiple places. (#9818, thanks @maiha)
- Fix typos, misspelling and styling. (#9636, #9638, #9561, #9786, #9840, #9844, #9854, #9869, #10068, #10123, #10102, #10116, #10229, #10252, thanks @kubo, @m-o-e, @mgomes, @philipp-classen, @dukeraphaelng, @camreeves, @docelic, @ilmanzo, @Sija, @pxeger, @oprypin)
Macros
- Fix documentation for
#[]=
macro methods. (#10025, thanks @HertzDevil)
Numeric
- (breaking-change) Move
Complex#exp
,Complex#log
, etc. toMath.exp
,Math.log
overloads. (#9739, thanks @cristian-lsdb) - (performance) Use unchecked arithmetics in
Int#times
. (#9511, thanks @waj) - Check for overflow when extending signed integers to unsigned integers. (#10000, thanks @HertzDevil)
- Fix
sprintf
for zero left padding a negative number. (#9725, thanks @asterite) - Fix
BigInt#to_64
andBigInt#hash
. (#10121, thanks @oprypin) - Fix
BigDecimal#to_s
for numbers between-1
and0
. (#9897, thanks @dukeraphaelng) - Fix
Number#step
. (#10130, #10295, thanks @straight-shoota, @bcardiff) - Make
Complex
unary plus returnsself
. (#9719, thanks @asterite) - Improve
Int#lcm
andInt#gcd
. (#9999, thanks @HertzDevil) - Add
Math::TAU
. (#10179, thanks @j8r) - Add wrapped unary negation to unsigned integer types to allow
&- x
expressions. (#9947, thanks @HertzDevil) - Improve documentation of mathematical functions. (#9994, thanks @HertzDevil)
Text
- (breaking-change) Fix
String#index
not working well for broken UTF-8 sequences. (#9713, thanks @asterite) - (performance)
String
: Don't materializeRegex
match[0]
if not needed. (#9615, thanks @asterite) - Fix
String#rindex
default offset for matching empty regex correctly. (#9690, thanks @makenowjust) - Add various
String#delete_at
methods. (#9398, thanks @asterite) - Raise if passing
null
Pointer toString
. (#9653, thanks @jgaskins) - Add
Regex#capture_count
. (#9746, thanks @Sija) - Add
Regex::MatchData#[]
overloading toRange
. (#10076, thanks @makenowjust) - Fix duplicates in
String
documentation. (#9987, thanks @Nicolab) - Add docs for substitution to
Kernel.sprintf
. (#10227, thanks @straight-shoota)
Collections
- (breaking-change) Make
Hash#reject!
,Hash#select!
, andHash#compact!
consistent withArray
and returnself
. (#9904, thanks @caspiano) - (breaking-change) Deprecate
Hash#delete_if
in favor ofHash#reject!
, addDequeue#reject!
andDequeue#select!
. (#9878, thanks @caspiano) - (breaking-change) Change
Set#delete
to return Bool. (#9590, thanks @j8r) - (breaking-change) Drop deprecated
Enumerable#grep
. (#9711, thanks @j8r) - (breaking-change) Remove
Hash#key_index
. (#10016, thanks @asterite) - (breaking-change) Deprecate
StaticArray#[]=(value)
in favor ofStaticArray#fill
. (#10027, thanks @HertzDevil) - (breaking-change) Rename
Set#{sub,super}set?
to{sub,super}set_of?
. (#10187, thanks @straight-shoota) - (performance) Optimize
Array#shift
andArray#unshift
. (#10081, thanks @asterite) - (performance)
Array#rotate
optimization for small arrays. (#8516, thanks @wontruefree) - Fix
Hash#dup
andHash#clone
to return correct type for subclasses. (#9871, thanks @vlazar) - Fix
Iterator#cons_pair
return type. (#9788, thanks @asterite) - Fix key type restriction of
Hash#merge
block. (#9495, thanks @makenowjust) - Fix
Range#step
. (#10203, thanks @straight-shoota) - Let
Range#step
delegate tobegin.step
and allow float based ranges to be stepped. (#10209, thanks @straight-shoota) - Fix
Indexable#join
withIO
. (#10152, thanks @straight-shoota) - Fix
Flatten
for value-type iterators. (#10096, thanks @f-fr) - Fix
Indexable.range_to_index_and_count
to not raiseIndexError
. (#10191, thanks @straight-shoota) - Handle recursive structures in
def_clone
,Hash
,Array
,Dequeue
. (#9800, thanks @asterite) - Add
BitArray#dup
. ([#9550](#9550...
0.35.1
Standard library
Collections
Networking
- Revert
IO#write
changes in 0.35.0 and let it return Nil. (#9469, thanks @bcardiff) - Avoid leaking logging context in HTTP request handlers. (#9494, thanks @Blacksmoke16)
Crypto
- Use less strict cipher compatibility for OpenSSL client context. (#9459, thanks @straight-shoota)
- Fix
Digest::Base
block argument type restrictions. (#9500, thanks @straight-shoota)
Logging
Compiler
- Show warnings even if there are errors. (#9461, thanks @asterite)
- Fix parsing of
{foo: X, typeof: Y}
type. (#9453, thanks @makenowjust) - Fix parsing of proc in hash
of
key type. (#9458, thanks @makenowjust) - Revert debug level information changes in specs to fix 32 bits builds. (#9466, thanks @bcardiff)
Others
- CI improvements and housekeeping. (#9455, thanks @bcardiff)
- Code formatting. (#9482, thanks @makenowjust)
0.35.0
Language changes
- (breaking-change) Let
case when
be non-exhaustive, introducecase in
as exhaustive. (#9258, #9045, thanks @asterite) - Allow
->@ivar.foo
and->@@cvar.foo
expressions. (#9268, thanks @makenowjust)
Macros
Standard library
- (breaking-change) Refactor to standardize on first argument for methods receiving
IO
. (#9134, #9289, #9303, #9318, thanks @straight-shoota, @bcardiff, @oprypin) - (breaking-change) Cleanup Digest and OpenSSL::Digest. (#8426, thanks @didactic-drunk)
- Fix
Enum#to_s
for private enum. (#9126, thanks @straight-shoota) - Refactor
Benchmark::IPS::Entry
to useUInt64
inbytes_per_op
. (#9081, thanks @jhass) - Add
Experimental
annotation and doc label. (#9244, thanks @bcardiff) - Add subcommands to
OptionParser
. (#9009, #9133, thanks @RX14, @Sija) - Make
NamedTuple#sorted_keys
public. (#9263, thanks @waj) - Fix example codes in multiple places. (#9203, thanks @maiha)
Macros
- (breaking-change) Remove top-level
assert_responds_to
macro. (#9085, thanks @bcardiff) - (breaking-change) Drop top-level
parallel
macro. (#9097, thanks @bcardiff) - Fix lazy property not forwarding annotations. (#9140, thanks @asterite)
- Add
host_flag?
macro method, not affected by cross-compilation. (#9049, thanks @oprypin) - Add
.each
and.each_with_index
to various macro types. (#9120, thanks @Blacksmoke16) - Add
StringLiteral#titleize
macro method. (#9269, thanks @makenowjust) - Add
TypeNode
methods to check what "type" the node is. (#9270, thanks @Blacksmoke16) - Fix support
TypeNode.name(generic_args: false)
for generic instances. (#9224, thanks @Blacksmoke16)
Numeric
- (breaking-change) Add
Int#digits
, reverseBigInt#digits
result. (#9383, thanks @asterite) - Fix overflow checking for operations with mixed sign. (#9403, thanks @waj)
- Add
BigInt#factorial
using GMP. (#9132, thanks @peheje)
Text
- Add
String#titleize
. (#9204, thanks @hugopl) - Add
Regex#matches?
andString#matches?
. (#8989, thanks @makenowjust) - Add
IO
overloads to variousString
case methods. (#9236, thanks @Blacksmoke16) - Improve docs examples regarding
Regex::MatchData
. (#9010, thanks @makenowjust) - Improve docs on
String
methods. (#8447, thanks @jan-zajic)
Collections
- (breaking-change) Add
Enumerable#first
with fallback block. (#8999, thanks @makenowjust) - Fix
Array#delete_at
bug with negative start index. (#9399, thanks @asterite) - Fix
Enumerable#{zip,zip?}
when self is anIterator
. (#9330, thanks @mneumann) - Make
Range#each
andRange#reverse_each
work better with end/begin-less values. (#9325, thanks @asterite) - Improve docs on
Hash
. (#8887, thanks @rdp)
Serialization
- (breaking-change) Deprecate
JSON.mapping
andYAML.mapping
. (#9272, thanks @straight-shoota) - (breaking-change) Make
INI
a module. (#9408, thanks @j8r) - Fix integration between
record
macro andJSON::Serializable
/YAML::Serializable
regarding default values. (#9063, thanks @Blacksmoke16) - Fix
XML.parse
invalid mem access in multi-thread. (#9098, thanks @bcardiff, @asterite) - Fix double string escape in
XML::Node#content=
. (#9300, thanks @straight-shoota) - Improve xpath regarding namespaces. (#9288, thanks @asterite)
- Escape CDATA end sequences. (#9230, thanks @Blacksmoke16)
- Add
JSON
andYAML
serialization toPath
. (#9156, thanks @straight-shoota) - Specify pkg-config name for
libyaml
. (#9426, thanks @jhass) - Specify pkg-config name for
libxml2
. (#9436, thanks @Blacksmoke16) - Make YAML specs robust against libyaml 0.2.5. (#9427, thanks @jhass)
Time
- (breaking-change) Support different number of fraction digits for RFC3339 time format. (#9283, thanks @waj)
- Fix parsing AM/PM hours. (#9334, thanks @straight-shoota)
- Improve
File.utime
precision from second to 100-nanosecond on Windows. (#9344, thanks @kubo)
Files
- (breaking-change) Move
Flate
,Gzip
,Zip
,Zlib
toCompress
. (#8886, thanks @bcardiff) - (breaking-change) Cleanup
File
&FileUtils
. (#9175, thanks @bcardiff) - Fix realpath on macOS 10.15 (Catalina). (#9296, thanks @waj)
- Fix
File#pos
,File#seek
andFile#truncate
over 2G on Windows. (#9015, thanks @kubo) - Fix
File.rename
to overwrite the destination file on Windows, like elsewhere. (#9038, thanks @oprypin) - Fix
File
's specs and related exception types on Windows. (#9037, thanks @oprypin) - Add support for
Path
arguments to multiple methods. (#9153, thanks @straight-shoota) - Add
Path#each_part
iterator. (#9138, thanks @straight-shoota) - Add
Path#relative_to
. (#9169, thanks @straight-shoota) - Add support for
Path
pattern toDir.glob
. (#9420, thanks @straight-shoota) - Implement
File#fsync
on Windows. (#9257, thanks @kubo) - Refactor
Path
regarding empty and.
. (#9137, thanks @straight-shoota)
Networking
- (breaking-change) Make
IO#skip
,IO#write
returns the number of bytes it skipped/written asInt64
. (#9233, #9363, thanks @bcardiff) - (breaking-change) Improve error handling and logging in
HTTP::Server
. (#9115, #9034, thanks @waj, @straight-shoota) - (breaking-change) Change
HTTP::Request#remote_address
type toSocket::Address?
. (#9210, thanks @waj) - Fix
flush
methods to always flush underlyingIO
. (#9320, thanks @straight-shoota) - Fix
HTTP::Server
sporadic failure in SSL handshake. (#9177, thanks @waj) WebSocket
shouldn't reply with same close code. (#9313, thanks @waj)- Ignore response body during
WebSocket
handshake. (#9418, thanks @waj) - Treat cookies which expire in this instant as expired. (#9061, thanks @RX14)
- Set
sync
orflush_on_newline
for standard I/O on Windows. (#9207, thanks @kubo) - Prefer HTTP basic authentication in OAuth2 client. (#9127, ...
0.34.0
Language changes
- (breaking-change) Exhaustive
case
expression check added, for now it produces warnings. (#8424, #8962, thanks @asterite, @Sija) - Let
Proc(T)
be used as aProc(Nil)
. (#8969, #8970, thanks @asterite)
Standard library
- (breaking-change) Replace
Errno
,WinError
,IO::Timeout
withRuntimeError
,IO::TimeoutError
,IO::Error
,File::Error
,Socket::Error
, and subclasses. (#8885, thanks @waj) - (breaking-change) Replace
Logger
module in favor ofLog
module. (#8847, #8976, thanks @bcardiff) - (breaking-change) Move
Adler32
andCRC32
toDigest
. (#8881, thanks @bcardiff) - (breaking-change) Remove
DL
module. (#8882, thanks @bcardiff) - Enable more win32 specs. (#8683, #8822, thanks @straight-shoota)
- Make
SemanticVersion::Prerelease
comparable. (#8991, thanks @makenowjust) - Use
flag?(:i386)
instead of obsoleteflag?(:i686)
. (#8863, thanks @bcardiff) - Remove Windows workaround using
vsnprintf
. (#8942, thanks @oprypin) - Fixed docs broken link to ruby's prettyprint source. (#8915, thanks @MattHin)
- Update
OptionParser
example to exit on--help
. (#8927, thanks @vlazar)
Numeric
- Fixed
Float32#to_s
corner-case. (#8838, thanks @toddsundsted) - Fixed make
Big*#to_u
raise on negative values. (#8826, thanks @Sija) - Fixed
BigDecimal#to_big_i
regression. (#8790, thanks @Sija) - Add
Complex#round
. (#8819, thanks @miketheman) - Add
Int#bit_length
andBigInt#bit_length
. (#8924, #8931, thanks @asterite) - Fixed docs of
Int#gcd
. (#8894, thanks @nard-tech)
Text
- (breaking-change) Deprecate top-level
with_color
in favor ofColorize.with
. (#8892, #8958, thanks @bcardiff, @oprypin) - Add overloads for
String#ljust
,String#rjust
andString#center
that take anIO
. (#8923, thanks @asterite) - Add missing
Regex#hash
andRegex::MatchData#hash
. (#8986, thanks @makenowjust) - Upgrade Unicode to 13.0.0. (#8906, thanks @Blacksmoke16)
- Revert deprecation of
String#codepoint_at
. (#8902, thanks @vlazar) - Move
Iconv
toCrystal
namespace. (#8890, thanks @bcardiff)
Collections
- Fixed make
Range#size
raise on an open range. (#8829, thanks @Sija) - Add
Enumerable#empty?
. (#8960, thanks @Sija) - (performance) Optimized Implementation of
Array#fill
for zero Values. (#8903, thanks @toddsundsted) - Refactor
Reflect
to anEnumerable
private definition. (#8884, thanks @bcardiff)
Serialization
- (breaking-change) Rename
YAML::Builder.new
with block toYAML::Builder.build
. (#8896, thanks @straight-shoota) - Add
XML.build_fragment
. (#8813, thanks @straight-shoota) - Add
CSV#rewind
. (#8912, thanks @asterite) - Add
Deque#from_json
andDeque#to_json
. (#8850, thanks @carlhoerberg) - Call to
IO#flush
onCSV
,INI
,JSON
,XML
, andYAML
builders. (#8876, thanks @asterite) - Add docs to
Object.from_yaml
. (#8800, thanks @wowinter13)
Time
- (breaking-change) Improve
Time::Span
initialization API with mandatory named arguments. (#8257, #8857, thanks @dnamsons, @bcardiff) - Add
Time::Span#total_microseconds
. (#8966, thanks @vlazar)
Files
- Fixed multi-thread race condition by setting
fd
to-1
on closedFile
/Socket
. (#8873, thanks @bcardiff) - Fixed
File.dirname
with unicode chars. (#8911, thanks @asterite) - Add
IO::Buffered#flush_on_newline
back and set it to true for non-tty. (#8935, thanks @asterite) - Forward missing methods of
IO::Hexdump
to underlyingIO
. (#8908, thanks @carlhoerberg)
Networking
- (breaking-change) Correctly support WebSocket close codes. (#8975, #8981, thanks @RX14, @Sija)
- Make
HTTP::Client
return emptybody_io
if content-length is zero. (#8503, thanks @asterite) - Fixed
UDP
specs in the case of a local firewall. (#8817, thanks @RX14) - Fixed
MIME
spec examples to not collide with actual registry. (#8795, thanks @straight-shoota) - Fixed
UNIXServer
, andHTTP::WebSocket
specs to ensure server is accepting before closing. (#8755, #8879, thanks @bcardiff) - Add type annotation to
tls
argument inHTTP
. (#8678, thanks @j8r) - Add
Location
toHTTP::Request
common header names. (#8992, thanks @mamantoha)
Concurrency
- Add docs on
Future
regarding exceptions. (#8860, thanks @rdp) - Disable occasionally failing
Thread
specs on musl. (#8801, thanks @straight-shoota)
System
- Fixed typo on
src/signal.cr
. (#8805, thanks @lbguilherme)
Runtime
- Fixed exceptions not being inspectable when running binary from PATH. (#8807, thanks @willhbr)
- Move
AtExitHandlers
toCrystal
namespace. (#8883, thanks @bcardiff)
Compiler
- (breaking-change) Drop
disable_overflow
compiler flag. (#8772, thanks @Sija) - Fixed url in "can't infer block return type" error message. (#8869, thanks @nilium)
- Fixed typo in math interpreter error message. (#8941, thanks @j8r)
- Use
CRYSTAL_OPTS
environment variable as default compiler options. (#8900, thanks @bcardiff) - Avoid using the default
--exclude-warnings
value if some is specified. (#8899, thanks @bcardiff) - Honor
LIBRARY_PATH
as default library path, and allow linking with no explicit/usr/lib:/usr/local/lib
paths. (#8948, thanks @bcardiff) - Fix Windows LLVM globals codegen in non-single-module mode. (#8978, thanks @oprypin)
- Add support for LLVM 10. (#8940, thanks @RX14)
- Remove redundant calls to
Object.to_s
in interpolation in compiler's code. (#8947, thanks @veelenga)
Language semantics
- Type as
NoReturn
if calling method on abstract class with no concrete subclasses. (#8870, thanks @asterite)
Tools
- Add
crystal init
name validation. (#8737, thanks @straight-shoota)
Doc generator
Others
0.33.0
Language changes
Macros
- Add
TypeNode#name(generic_args : BoolLiteral)
to returnTypeNode
's name with or without type vars. (#8483, thanks @Blacksmoke16)
Standard library
- (breaking-change) Remove several previously deprecated methods and modules:
PartialComparable
,Crypto::Bcrypt::Password#==
,HTTP::Server::Response#respond_with_error
,JSON::PullParser::Kind#==
,Symbol#==(JSON::PullParser::Kind)
,JSON::Token#type
,String#at
,Time.new
,Time.now
,Time.utc_now
,URI.escape
,URI.unescape
. (#8646, #8596, thanks @bcardiff, @Blacksmoke16) - Fixed docs wording. (#8606, #8784, thanks @fxn)
- Add
Object#in?
. (#8720, #8723, thanks @Sija) - Allow to create an enum from a symbol. (#8634, thanks @bew)
- Add
VaList#next
for getting the next element in a variadic argument list. (#8535, #8688, thanks @ffwff, @RX14) - Refactor
ARGF
implementation. (#8593, thanks @arcage) - Fixed specs of
Colorize
on dumb terminal. (#8673, thanks @oprypin) - Fixed some specs on Win32. (#8670, thanks @straight-shoota)
Numeric
- Add
BigInt#unsafe_shr
. (#8763, thanks @asterite) - Refactor
Float#fdiv
to use binary primitive. (#8662, thanks @bcardiff)
Text
Collections
- Fixed
Enumerable#zip
to work with union types. (#8621, thanks @asterite) - Fixed docs regarding
Hash
'sinitial_capacity
. (#8569, thanks @r00ster91)
Serialization
- Improved JSON deserialization into union types. (#8689, thanks @kimburgess)
- Fixed expected error message in libxml2 error spec. (#8699, thanks @straight-shoota)
- Fixed
JSON::PullParser
overflow handling. (#8698, thanks @kimburgess) - Fixed
JSON::Any#dig?
/YAML::Any#dig?
on non-structure values. (#8745, thanks @Sija)
Time
- Fixed
Time#shift
over date boundaries with zone offset. (#8742, thanks @straight-shoota)
Files
- (breaking-change) Deprecate
File::Info#owner
, andFile::Info#group
; useowner_id
, andgroup_id
. (#8007, thanks @j8r) - Fixed
Path.new
receivingPath
as first argument. (#8753, thanks @straight-shoota) - Fixed
File.size
andFile.info
to work withPath
parameters. (#8625, thanks @snluu) - Fixed
Path
specs whenENV["HOME"]
is unset. (#8667, thanks @straight-shoota) - Refactor
Dir.mkdir_p
to usePath#each_parent
and make it work on Win32. (#8668, thanks @straight-shoota) - Fixed
IO::MultiWriter
specs to close file before reading/deleting it. (#8674, thanks @oprypin)
Networking
- Fixed invalid call to libevent and race conditions on closed
IO
when resuming readable/writable event. (#8707, #8733, thanks @bcardiff) - Fixed unexpected EOF in terminated SSL connection. (#8540, thanks @rdp)
- Fixed
HTTP::Cookie
to supportInt64
max-age values. (#8759, thanks @asterite) - Improve error message for
getaddrinfo
failure. (#8498, thanks @rdp) - Make
IO::SysCall#wait_readable
andIO::SysCall#wait_writable
public, yet:nodoc:
. (#7366, thanks @stakach) - Refactor
StaticFileHandler
to usePath
. (#8672, thanks @straight-shoota) - Remove fixed date in spec. (#8640, thanks @bcardiff)
- Remove non-portable error message in
TCPServer
spec. (#8702, thanks @straight-shoota)
Crypto
- Add
Crypto::Bcrypt::Password
check for invalid hash value. (#6467, thanks @miketheman) - Improve documentation for
Random::Secure
. (#8484, thanks @straight-shoota)
Concurrency
- Fixed
Future(Nil)
when the block raises. (#8650, thanks @lbguilherme) - Fixed
IO
closing in multi-thread mode. (#8733, thanks @bcardiff) - Fixed some regular failing specs in multi-thread mode. (#8592, #8643, #8724, #8761, thanks @bcardiff)
- Add docs to
Fiber
. (#8739, thanks @straight-shoota)
System
- Enable
system
module for Win32 in prelude. (#8661, thanks @straight-shoota) - Handle exceptions raised at
__crystal_sigfault_handler
. (#8743, thanks @waj)
Runtime
- Fixed wrongly collected exception object by the GC. Ensure
LibUnwind::Exception
struct is not atomic. (#8728, thanks @waj) - Fixed reporting of non-statement rows in DWARF backtrace. (#8499, thanks @rdp)
- Add top level exception handler. (#8735, #8791, thanks @waj)
- Try to open stdio in non-blocking mode. (#8787, thanks @waj)
- Allow
Crystal::System.print_error
to useprintf
like format. (#8786, thanks @bcardiff)
Spec
- (breaking-change) Remove previously deprecated spec method
assert
. (#8767, thanks @Blacksmoke16) Spec::JUnitFormatter
output and options enhancements. (#8599, #8692, thanks @Sija, @bcardiff)
Compiler
- (breaking-change) Drop support for previously deprecated comma separators in enums and other cleanups. (#8657, thanks @bcardiff)
- (breaking-change) Drop uppercase F32 and F64 float number suffixes. (#8782, thanks @rhysd)
- Fixed memory corruption issues by using LLVM's
memset
andmemcpy
that matches target machine. (#8746, thanks @bcardiff) - Fixed ICE when trying to add type inside annotation. (#8628, thanks @asterite)
- Fixed ICE on
typeof
in an unused block. (#8695, thanks @asterite) - Fixed ICE in case of wrong target triple. (#8710, thanks @Sija)
- Fixed ICE when raising a macro exception with empty message. (#8654, thanks @jan-zajic)
- Fixed parser bug macro with "eenum" in it. (#8760, thanks @asterite)
- Change
CRYSTAL_PATH
to allow shards to override std-lib. (#8752, thanks @bcardiff)
Language semantics
- Fixed missing virtualization of
Proc
pointer. (#8757, thanks @asterite) - Fixed type of vars after
begin
/rescue
if allrescue
are unreachable. (#8758, thanks @asterite) - Fixed visibility propagation to macro expansions in all cases. (#8762, #8796, thanks @asterite)
Tools
- Update
crystal init
to handle.
. (#8681, thanks @jethrodaniel)
Formatter
- Fixed indent after comme...
0.32.1
0.32.0
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](https:...
0.31.1
0.31.0
Language changes
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
0.30.1
Standard library
Numeric
- Fixed
Number#humanize
digits. (#8027, thanks @straight-shoota)
Networking
- Fixed TCP socket leaking after failed SSL connect in
HTTP::Client#socket
. (#8025, thanks @straight-shoota) - Honor normalized header names for HTTP requests. (#8061, thanks @asterite)
Concurrency
- Don't resume fibers directly from event loop callbacks (or support for libevent 2.1.11). (#8058, thanks @waj)
Compiler
- Fixed
sizeof(Nil)
and other empty types. (#8040, thanks @asterite) - Avoid internal globals of type i128 or u128. (or workaround a llvm 128 bits bug). (#8063, thanks @bcardiff, @asterite)
Language semantics
- Consider abstract method implementation in supertype for abstract method checks. (#8035, thanks @asterite)
Tools
Formatter
- Handle consecutive macro literals when subformatting. (#8034, thanks @asterite)
- Fixed crash when formatting syntax error inside macro. (#8055, thanks @asterite)