Releases: crystal-lang/crystal
0.30.0
Language changes
- (breaking-change) Enforce abstract methods return types. (#7956, #7999, #8010, thanks @asterite)
- (breaking-change) Don't allow ranges to span across lines. (#7888, thanks @oprypin)
Macros
- Add
args
/named_args
macro methods toAnnotations
. (#7694, thanks @Blacksmoke16) - Unify
resolve
andtypes
macro methods API forType
andPath
for convenience. (#7970, thanks @asterite)
Standard library
- (breaking-change) Remove
UUID#to_slice
in favor ofUUID#bytes
to fix dangling pointer issues. (#7901, thanks @ysbaddaden) - (performance) Improve
Box
of reference types. (#8016, thanks @waj) - Fixed initial seed of
Random::ISAAC
. (#7977, thanks @asterite) - Fixed mem intrinsics for aarch64. (#7983, thanks @drujensen)
- Add
Benchmark.memory
. (#7835, thanks @r00ster91) - Allow setting default capacity for
StringPool
. (#7899, thanks @carlhoerberg) - Add type restrictions to
INI
. (#7831, thanks @j8r) - Fixed
Logger
docs. (#7898, thanks @dprobinson) - Fix example codes in multiple places. (#8003, thanks @maiha)
Numeric
- Fixed incorrect
Int#%
overflow. (#7980, thanks @asterite) - Fixed inconsistency between
Float#to_s
andBigFloat#to_s
, always show.0
for whole numbers. (#7982, thanks @Lasvad)
Text
Collections
- Add
Enumerable#tally
. (#7921, thanks @kachick) - Add
Enumerable#reduce?
overload with not initial value. (#7941, thanks @miketheman) - Fix specs of
Enumerable#min_by?
. (#7919, thanks @kachick)
Serialization
- (breaking-change) JSON: use enums instead of symbols. (#7966, thanks @asterite)
- Fixed YAML deserialization of String in a union type. (#7938, thanks @asterite)
- Validate element names in
XML::Builder
. (#7965, thanks @Blacksmoke16) - Allow numeric keys in JSON (ie:
Hash(Int32, String).from_json
). (#7944, thanks @asterite) - Add
alias
/merge
methods toYAML::Builder
andYAML::Nodes::Builder
. (#7949, thanks @Blacksmoke16)
Files
- Adds
File.readlink
to matchFile.symlink
. (#7858, thanks @didactic-drunk)
Networking
- (breaking-change) Improve URL encoding.
URI.escape
andURI.unescape
are renamed toURI.encode_www_form
andURI.decode_www_form
. AddURI.encode
andURI.decode
. (#7997, #8021, thanks @straight-shoota, @bcardiff) - (performance) HTTP protocol parsing optimizations. (#8002, #8009, thanks @asterite)
- Fixed
HTTP::Server
response double-close. (#7908, thanks @asterite) - Enforce
HTTP::Client
host argument is just a host. (#7958, thanks @asterite) - Allow
HTTP::Params.encode
to encode an arrays of values for a key. (#7862, thanks @rodrigopinto) - Forward
read_timeout
/write_timeout
in ssl socket to underlaying socket. (#7820, thanks @carlhoerberg) - Natively support Same-site Cookies. (#7864, thanks @Blacksmoke16)
- Allow setting buffer size for
IO::Buffered
. (#7930, thanks @carlhoerberg)
Crypto
- Require openssl algorithm in pkcs5. (#7985, thanks @will)
- Fixed cipher expectation in
OpenSSL::SSL::Socket
spec. (#7871, thanks @j8r)
Concurrency
System
- Introduce
System::User
andSystem::Group
. (#7725, thanks @woodruffw, @chris-huxtable) - Add docs for
Process::Status.exit_status
(#7873). (#8014, thanks @UlisseMini)
Compiler
- Fixed codegen of
pointer.as(Nil)
. (#8019, thanks @asterite) - Fixed edge cases in parser and stringifier. (#7886, thanks @oprypin)
- Fixed
concrete_types
for virtual metaclass and modules. (#7951, thanks @bcardiff) - Fixed incorrect
remove_indirection
inTypeDefType
. (#7971, thanks @bcardiff) - Fixed missing
CRYSTAL_SPEC_COMPILER_FLAGS
usage in some more specs. (774768, thanks @bcardiff) - Revamp compile error formatting & output. (#7748, thanks @martimatix)
- Add support for LLVM 8. (#7987, thanks @bcardiff)
- Add support for LLVM 7. (#7986, thanks @bcardiff, @waj, @foutrelis, @wmoxam)
- Add debug log helper function for codegen. (#7935, #7937, thanks @bcardiff)
- Refactor codegen of unions. (#7940, thanks @bcardiff)
- Move
LLVMId
fromCodeGenVisitor
toProgram
. (#7973, thanks @bcardiff) - Minor additions and refactors on for LLVM codegen. (#7972, thanks @bcardiff)
- Add
bin/check-compiler-flag
helper script. Addmake clean_cache
. (da3892, thanks @bcardiff)
Language semantics
- Fixed generic metaclass argument expansion. (#7916, thanks @asterite)
- Fixed top-level private const not being scoped. (#7907, thanks @asterite)
- Fixed enum overflow when declaring members. (#7881, thanks @asterite)
- Fixed annotation lookup on generic types. (#7891, thanks @asterite)
Tools
Formatter
Doc generator
- Allow rendering tags on methods without any docs. (#7952, thanks @Blacksmoke16)
Others
0.29.0
Standard library
Macros
- Fix inheritance support of
record
macro. (#7811, thanks @asterite) - Omit quotes in
puts
macro output. (#7734, thanks @asterite)
Numeric
- (performance) Optimize
String#to_u
methods for the case of a negative number. (#7446, thanks @r00ster91)
Text
- (breaking-change) Deprecate
String#at
, useString#char_at
. (#7633, thanks @j8r) - (breaking-change) Change
String#to_i
to parse octals with prefix0o
(but not0
by default). (#7691, thanks @icy-arctic-fox) - (breaking-change) Restrict some
String#to_i
arguments to beBool
. (#7436, thanks @j8r) - Add
downcase
option toString#camelcase
. (#7717, thanks @wontruefree) - Add support for unicode 12.0.0. (#7721, thanks @Blacksmoke16)
- Fix
Unicode
not showing up in the API docs. (#7720, thanks @r00ster91)
Collections
- (breaking-change) Remove
Slice#pointer
. (#7581, thanks @Maroo-b) - Add sort methods to
Slice
. (#7597, thanks @Maroo-b) - Add
Slice#[]?
. (#7701, thanks @Sija) - Improve docs for
Slice#[]
. (#7780, thanks @Sija)
Serialization
Time
- Fix time format RFC 3339 to not include offset seconds. (#7492, thanks @straight-shoota)
Files
- (breaking-change) Rename
File::DEVNULL
toFile::NULL
. (#7778, thanks @r00ster91) - Fix handling of files starting with
~
inPath#expand
. (#7768, thanks @byroot) - Fix
Dir.glob(match_hidden: false)
not hiding hidden files properly. (#7774, thanks @ayazhafiz)
Networking
- (breaking-change) Let
IO#copy
returnUInt64
. (#7660, thanks @asterite) - Add support for UDP multicast. (#7423, thanks @stakach)
- Add missing requires to
openssl.cr
. (#7803, thanks @RX14) - Add
IO::MultiWriter#flush
. (#7765, thanks @mamantoha) - Add
OpenSSL::SSL::Socket#cipher
and#tls_version
. (#7445, thanks @carlhoerberg) - Improve
URI#normalize
. (#7635, thanks @straight-shoota) - Improve documentation of some
URI
methods. (#7796, thanks @r00ster91) - Refactor
StaticFileHandler
specs forLast-Modified
header. (#7640, thanks @straight-shoota) - Refactor compression usage in handler specs. (#7819, thanks @asterite)
Crypto
Concurrency
Compiler
- (breaking-change) Fix require relative path resolution. (#7758, thanks @asterite)
- (breaking-change) Disallow '!' or '?' at the end of the LHS in an assignment. (#7582, thanks @Maroo-b)
- Allow running compiler_specs with specific flags. (#7837, thanks @bcardiff)
- Fix extend from generic types. (#7812, thanks @asterite)
- Don't virtualize types in
Union(...)
and keep more accurate type information. (#7815, thanks @asterite) - Do not generate debug metadata for arguments of naked functions. (#7775, thanks @eyusupov)
- Detect deprecation on initialize methods and methods with named args. (#7724, thanks @bcardiff)
- Fix track of AST nodes location. (#7827, thanks @asterite)
- Fix
offsetof
not being usable with macros. (#7703, thanks @malte-v) - Allow parsing of
call &.@ivar
. (#7754, thanks @asterite) - Fix
Def#to_s
with**options
and&block
. (#7854, thanks @makenowjust) - Check
pointerof
inner expression for errors. (#7755, thanks @asterite) - Fix some error messages. (#7833, thanks @asterite)
- Improve wording of
pointerof(self)
parser error. (#7542, thanks @r00ster91) - Fix typo. (#7828, thanks @RX14)
Language semantics
- (breaking-change) Fix new/initialize lookup regarding modules. (#7818, thanks @asterite)
- (breaking-change) Don't precompute
sizeof
on abstract structs and modules. (#7801, thanks @asterite) - Consider macro calls in
@ivar
initializer. (#7750, thanks @asterite) - Give precedence to
T.class
overClass
in method lookup. (#7759, thanks @asterite) - Honor enum base type on non-default values. (#7776, thanks @asterite)
- Avoid lookup of private def defined inside macro. (#7733, thanks @asterite)
- Improve type flow of var in
if
with&&
. (#7785, thanks @asterite) - Fix handling of
NoReturn
inif
. (#7792, thanks @asterite) - Improve edge issues with
while
andrescue
. (#7806, thanks @asterite) - Improve error on macro call in proc pointer. (#7757, thanks @asterite)
- Fix error on named args forwarding. (#7756, thanks @asterite)
- Check
NoReturn
type in named args. (#7761, thanks @asterite) - Fix internal handling of unbound/abstract generic types. (#7781, thanks @asterite)
- Fix wrong cast to unbound generic type. (#7793, thanks @asterite)
- Fix subclass observer to handle edge case call over generic types. (#7735, thanks @asterite)
- Fix edge case of abstract struct with one subclass. (#7787, thanks @asterite)
- Make automatic cast work with
with ... yield
. (#7746, thanks @asterite)
Tools
- Allow to lookup class and module implementations. (#7742, thanks @makenowjust)
- Refactor old duplicated 'def contains_target'. (#7739, thanks @makenowjust)
Formatter
- Don't produce unnecessary newline before named args following heredoc. (#7695, thanks @makenowjust)
- Fix formatting of multiline call arguments. (#7745, thanks @makenowjust)
- Fix formatting of annotations with newlines and spaces. (#7744, thanks @makenowjust)
- Refactor code to format &.[]. (#7699, thanks @makenowjust)
Others
0.28.0
Language changes
- (breaking-change) Enum declaration members can no longer be separated by a space, only by a newline,
;
or,
, the latter being deprecated and reformatted to a newline. (#7607, #7618, thanks @asterite, and @j8r) - Add begin-less and end-less ranges:
array[5..]
. (#7179, thanks @asterite) - Add
offsetof(Type, @ivar)
expression. (#7589, thanks @malte-v)
Macros
- Add
Type#annotations
to list all annotations and not just the last of each kind. (#7326, thanks @Blacksmoke16) - Add
ArrayLiteral#sort_by
macro method. (#3947, thanks @jreinert)
Standard library
- (breaking-change) Allow creating
None
enum flag withEnum.from_value
. (#6516, thanks @bew) - (breaking-change) Add deprecation message to
PartialComparable
. Its behaviour has been fully integrated intoComparable
. (#7664, thanks @straight-shoota) - (performance) Optimize dwarf line numbers decoding. (#7413, thanks @asterite)
- Fix
Signal::CHLD.reset
not clearing previous handler. (#7409, thanks @asterite) - Add lazy versions of
Object.getter?
andObject.property?
macros. (#7322, thanks @Sija) - Allow returning other values than
-1
,0
and1
byComparable#<=>
. (#7277, thanks @r00ster91) - Add missing
require
statements to samples in the API docs. (#7564, thanks @Maroo-b) - Fix example codes in multiple places. (#7569, thanks @maiha)
- Add documentation for
@[Flags]
and@[Link]
annotations. (#7665, thanks @bcardiff) - Add documentation for
Bool
. (#7651, thanks @wontruefree) - Refactor to avoid usage of the thread-local
$errno
GLIBC_PRIVATE symbol. (#7496, thanks @felixvf) - Refactor to have similar signatures accross the stdlib for
#to_s
and#inspect
. (#7528, thanks @wontruefree)
Numeric
- (breaking-change) Add deprecation message to
Int#/
. It will return aFloat
in0.29.0
. UseInt#//
for integer division. (#7639, thanks @bcardiff) - Change
Number#inspect
to not show the type suffixes. (#7525, thanks @asterite) - Add
Int#leading_zeros_count
andInt#trailing_zeros_count
. (#7520, thanks @Sija) - Add
Big*#//
,BigInt#&
-ops and missing#floor
,#ceil
,#trunc
. (#7638, thanks @bcardiff) - Improve
OverflowError
message. (#7375, thanks @r00ster91)
Text
- (performance) Optimize
String#compare
in case of ASCII only. (#7352, thanks @r00ster91) - Add methods for human-readable formatting of numbers:
Number#format
,Number#humanize
, andInt#humanize_bytes
. (#6314, thanks @straight-shoota) - Add
String#rchop?
andString#lchop?
. (#7328, thanks @j8r) - Add
options
argument toString#camelcase
andString#underscore
. (#7374, thanks @r00ster91) - Add docs to
Unicode::CaseOptions
. (#7513, thanks @r00ster91) - Improve specs and docs for
String#each_line
andIO#each_line
. (#7419, thanks @straight-shoota)
Collections
- (breaking-change) Let
Array#sort
only use<=>
, and let<=>
returnnil
for partial comparability. (#6611, thanks @asterite) - (breaking-change) Drop
Iterator#rewind
. Implement#cycle
by storing elements in an array. (#7440, thanks @asterite) - (performance) Add
Enumerable#each_cons
support forDeque
as a reuse buffer. (#7233, thanks @yxhuvud) - (performance) Change
Range#bsearch
/ 2
to>> 1
for faster performance. (#7531, thanks @Fryguy) - Fix
Slice#clone
for non-primitive types and deep copy. (#7591, thanks @straight-shoota) - Move
Indexable#zip
andIndexable#zip?
toEnumerable
and make it work with any number ofIndexable
orIterable
orIterator
. (#7453, thanks @asterite) - Add
Slice#[](Range)
. (#7439, thanks @asterite) - Add nillable range fetching
#[]?(Range)
toArray
andString
. (#7338, thanks @j8r) - Add
Set#add?
. (#7495, thanks @Sija) - Improve documentation of
Hash
regarding ordering of items. (#7594, thanks @straight-shoota)
Serialization
- (breaking-change) Change return type of
YAML#libyaml_version
toSemanticVersion
. (#7555, thanks @asterite) - Fix support for libxml2 2.9.9. (#7477, thanks @asterite)
- Fix support for libyaml 0.2.2. (#7555, thanks @asterite)
- Add
BigDecimal.from_yaml
. (#7398, thanks @Sija)
Time
- (breaking-change) Rename
Time
constructors. DeprecateTime.now
to encourage usageTime.utc
orTime.local
(#5346, #7586, thanks @straight-shoota) - (breaking-change) Rename
Time#add_span
toTime#shift
for changing a time instance by calendar units and handle other units. (#6598, thanks @straight-shoota) - (breaking-change) Change
Time#date
to return aTuple
of{year, month, day}
. UseTime#at_beginning_of_day
if aTime
instance is wanted. (#5822, thanks @straight-shoota) - Fix Windows monotonic time bug. (#7377, thanks @domgetter)
- Refactor
Time
methods. (#6581, thanks @straight-shoota)
Files
- (breaking-change) Remove
IO#flush_on_newline
and onlysync
onSTDOUT
/STDIN
/STDERR
when they are TTY devices. (#7470, thanks @asterite) - Add
Path
type. (#5635, thanks @straight-shoota)
Networking
-
(breaking-change) Move
HTTP::Multipart
toMIME::Multipart
. (#7085, thanks @m1lt0n) -
(breaking-change) Stop parsing JSON in OAuth2 errors. (#7467, thanks @asterite)
-
(breaking-change) Fix
RequestProcessor
connection reuse logic. (#7055, thanks @straight-shoota) -
(breaking-change) Replace
HTTP.default_status_message_for(Int)
withHTTP::Status.new(Int).description
. (#7247, thanks @dwightwatson) -
(breaking-change) Fix issues in
URI
implementation.URI#opaque
method is merged intoURI#path
, which no longer returnsNil
.#parse
/#to_s
normalization and default port handling has changed. (#6323, thanks @straight-shoota) -
Fix write buffering in OpenSSL sockets. (#7460, thanks @carlhoerberg)
-
Fix leaks in
HTTP::Server
#bind_*
and specs. (#7197, thanks @straight-shoota) -
Add
HTTP::Status
andResponse#status
. (#7247, #7682, thanks @dwightwatson, and @bcardiff) -
Add support for OAuth 2.0 resource owner password credentials grant type. (#7424, thanks @Blacksmoke16)
-
Add support for IIS date format in cookies. (#7405, thanks @Sija)
-
Allow calls to
IO::Syscall#wait_readable
andIO::Syscall#wait_writable
. (#7366, thanks @stakach) -
Fix spec of
HTTP::Client
to not write server response after timeout. (#7402, thanks @asterite) -
Fix spec of
TCP::Server
for musl. ([#7484](...
0.27.2
0.27.1
Language changes
Standard library
- (performance) Optimize generating
UUID
fromString
. (#7030, thanks @jgaskins) - (performance) Improve
SemanticVersion
operations. (#7234, thanks @j8r) - Fixed markdown inline code parsing. (#7090, thanks @makenowjust)
- Fixed inappropriate uses of
Time.now
. (#7155, thanks @straight-shoota) - Make
Nil#not_nil!
raiseNilAssertionError
. (#7330, thanks @r00ster91) - Add SemanticVersion to API docs. (#7003, thanks @Blacksmoke16)
- Add docs to discourage the use of
Bool#to_unsafe
other than for C bindings. (#7320, thanks @oprypin) - Refactor
#to_s
to be independent of thename
method. (#7295, thanks @asterite)
Macros
- Fixed docs of
ArrayLiteral#unshift
. (#7127, thanks @Blacksmoke16) - Fixed
Annotation#[]
to acceptString
andSymbol
as keys. (#7153, thanks @makenowjust) - Fixed
NamedTupleLiteral#[]
to raise a compile error for invalid key type. (#7158, thanks @makenowjust) - Fixed
getter
/property
macros to work properly withBool
types. (#7313, thanks @Sija) - Add
read_file
macro method. (#6967, #7094, thanks @Sija, @woodruffw) - Add
StringLiteral#count
. (#7239, thanks @Blacksmoke16)
Numeric
- Fixed scale issues when dividing
BigDecimal
. (#7218, thanks @Sija) - Allow underscores in the
String
passed toBig*
constructors. (#7107, thanks @Sija) - Add conversion methods and docs to
Complex
. (#5440, thanks @Sija) - Add specs for
Int128
,UInt128
. (#7173, thanks @bcardiff) - Add unsafe number ops
value.to_X!
/T.new!
/Int#&**
. (#7226, thanks @bcardiff) - Add overflow detection with preview opt-in. (#7206, thanks @bcardiff)
Text
- Fixed
ECR
location error reported. (#7137, thanks @makenowjust) - Add docs to ECR. (#7121, thanks @KCErb)
- Refactor
String#to_i
to avoid future overflow. (#7172, thanks @bcardiff)
Collections
- Fixed docs example in
Hash#from
. (#7210, thanks @r00ster91) - Fixed docs links of
Enumerable#chunks
andIterator#chunk
. (#6941, thanks @r00ster91) - Remove implicit null skip from
Hash
toJSON
serialization. (#7053, thanks @makenowjust) - Add
Iterator#slice_after
. (#7146, thanks @asterite) - Add
Iterator#slice_before
. (#7152, thanks @asterite) - Add
Iteratory#slice_when
andIterator#chunk_while
. (#7159, thanks @asterite) - Add
Enumerable#to_h(&block)
. (#7150, thanks @Sija) - Add
Enumerable#one?
. (#7166, thanks @asterite) - Add several
Enumerable
,Iterator
andArray
overloads that accept a pattern. (#7174, thanks @asterite) - Add docs to hash constructors. (#6923, thanks @KCErb)
Serialization
- Add conversion between JSON and YAML. (#7232, thanks @straight-shoota)
- Standardize
#as_T
/#as_T?
methods betweenJSON::Any
/YAML::Any
. (#6556, thanks @j8r) - Add
Set#from_yaml
. (#6310, thanks @kostya)
Time
- Fixed
Time::Span
initializer andsleep
for big seconds. (#7221, thanks @asterite) - Fixed docs to show proper use of parse. (#7035, thanks @jwoertink)
- Add missing
Float#weeks
method similar toInt#weeks
. (#7165, thanks @vlazar)
Files
- Fix
mkstemps
support on aarch64. (#7300, thanks @silmanduin66) - Validate LibC error codes in specs involving Errno errors. (#7087, thanks @straight-shoota)
- Add microsecond precision to
System::File.utime
(Unix). (#7156, thanks @straight-shoota) - Add missing tempfile cleanup in specs. (#7250, thanks @bcardiff)
- Add docs for file open modes. (#6664, thanks @r00ster91)
Networking
- Fixed
HTTP::Client
edge case of exception during in TLS initialization. (#7123, thanks @asterite) - Fixed
OpenSSL::SSL::Error.new
to not raiseErrno
. (#7068, thanks @straight-shoota) - Fixed
URI
encoding inStaticFileHandler::DirectoryListing
. (#7072, thanks @Sija) - Add MIME registry. (#5765, #7079, #7080, thanks @straight-shoota, @Sija)
- Add
MIME::MediaType
for parsing mime media types. (#7077, thanks @straight-shoota) - Add support for 100-continue in
HTTP::Server::Response
. (#6912, thanks @jreinert) - Add support for creating sockets from raw file descriptors. (#6894, thanks @myfreeweb)
- Add SNI support for OpenSSL. (#7291, thanks @bararchy)
- Improve
HTTP::Server
docs. (#7251, thanks @straight-shoota) - Refactor
OpenSSL
specs to reduce chances of failing. (#7202, thanks @bcardiff)
Crypto
- Add
OpenSSL::Cipher#authenticated?
to see if the cipher supports aead. (#7223, thanks @danielwestendorf)
System
- Fixed inline ASM when compiling for ARM. (#7041, thanks @omarroth)
- Implement
Crystal::System
for Win32. (#6972, thanks @markrjr) - Add
Errno#errno_message
getter. (#6702, thanks @r00ster91)
Spec
- Detect nesting
it
andpending
at run-time. (#7297, thanks @makenowjust)
Compiler
- Fixed how
LLVM::Type.const_int
emitInt128
literals. (#7135, thanks @bcardiff) - Fixed ICE related to named tuples. (#7163, thanks @asterite)
- Fixed automatic casting for private top-level methods. (#7310, thanks @asterite)
- Give proper error if defining initialize inside enum, allow
Enum.new
. (#7266, thanks @asterite) - Give proper error when trying to access instance variable of union type. (#7194, thanks @asterite)
- Give proper error when trying to instantiate Module. (#6735, thanks @r00ster91)
- Give proper error related to named arguments. (#7288, thanks @asterite)
- Parse required comma between block args. (#7343, thanks @asterite)
- Improve inference in recursion that involves blocks. (#7161, thanks @asterite)
- Add locations to all expanded macro arguments. (#7008, thanks @makenowjust)
- Turn a not compiler specific error while requiring into ICE. (#7208, thanks @makenowjust)
- Remove old
nil?
error on pointer types. (#7180, thanks @asterite) - Improve too big tuple and named tuple error message. (#7131, thanks @r...
0.27.0
Language changes
Macros
Standard library
- Fixed
v1
,v2
,v3
,v4
,v5
methods ofUUID
. (#6952, thanks @r00ster91) - Fixed multiple docs typos and phrasing in multiple places. (#6778, #6963, thanks @r00ster91)
- Fixes
Pointer
/UInt
subtraction. (#6994, thanks @damaxwell) - Add stack overflow detection. (#6928, #6995, thanks @damaxwell)
- Add caller file and line to
Nil#not_nil!
. (#6712, thanks @yeeunmariakim) - Restrict
Enum#parse
/Enum#parse?
toString
arguments. (#6654, thanks @vladfaust) - Refactor and unify printing exceptions from within fibers. (#6594, thanks @Sija)
- Improve docs on properties generated by
property?
. (#6682, thanks @epergo) - Add docs to top level namespace constants. (#6971, thanks @r00ster91)
Macros
- Fix typos in
StringLiteral#gsub
and#tr
errors. (#6925, thanks @r00ster91)
Numeric
- (breaking-change) Disallow
rand
with zero value. (#6686, thanks @oprypin) - (breaking-change) Let
==
and!=
compare the values instead of bits when dealing with signed vs unsigned integers. (#6689, thanks @asterite) - Fixed
Int#downto
with unsigned int. (#6678, thanks @gmarcais) - Add wrapping arithmetics operators
&+
&-
&*
. (#6890, thanks @bcardiff) - Add floor divisions operator
Int#//
andFloat#//
. (#6891, thanks @bcardiff) - Add random support for
BigInt
. (#6687, thanks @oprypin) - Add docs related to
Float::Printer::*
. (#5438, thanks @Sija)
Text
- Add
String::Builder#chomp!
returns self. (#6583, thanks @Sija) - Add
:default
to colorize and documentColorRGB
,Color256
. (#6427, thanks @r00ster91) - Add
String::Formatter
support forc
flag and improve docs. (#6758, thanks @r00ster91)
Collections
- (breaking-change) Replace
Indexable#at
with#fetch
. RemoveHash#fetch(key)
as alias ofHash#[]
. (#6296, thanks @AlexWayfer) - Add
Hash/Indexable#dig/dig?
. (#6719, thanks @Sija) - Add
Iterator.chain
to chain array of iterators. (#6570, thanks @xqyww123) - Add
NamedTuple#to_h
over empty tuples. (#6628, thanks @icyleaf) - Optimize
Indexable#join
when all elements are strings. (#6635, thanks @asterite) - Optimize
Array#skip
. (#6946, thanks @asterite)
Serialization
- Fixed
YAML::Schema::FailSafe.parse
andparse_all
. (#6790, thanks @r00ster91) - Fixed order of
xmlns
and prefix inXML::Builder#namespace
. (#6743, thanks @yeeunmariakim) - Fixed
CSV.build
quoting ofChar
andSymbol
. (#6904, thanks @maiha) - Fixed docs for
JSON::Serializable
. (#6950, thanks @Heaven31415) - Add
XML::Attributes#delete
. (#6910, thanks @joenas) - Add ability to quote values always in
CSV.build
. (#6723, thanks @maiha) - Refactor how empty properties are handled in
JSON::Serializable
andYAML::Serializable
. (#6539, thanks @r00ster91)
Time
- (breaking-change) Rename
Time#epoch
toTime#to_unix
. Also#epoch_ms
to#unix_ms
, and#epoch_f
to#to_unix_f
. (#6662, thanks @straight-shoota) - Fixed spec for
Time::Location.load_local
withTZ=nil
. (#6740, thanks @straight-shoota) - Add support for ISO calendar week to
Time
. (#6681, thanks @straight-shoota) - Add
Time::Format
support for%G
,%g
,%V
. (#6681, thanks @straight-shoota) - Add
Time::Location
loader support for Windows. (#6363, thanks @straight-shoota) - Add
Time#to_local_in
to change time zone while keeping wall clock. (#6572, thanks @straight-shoota) - Add
Time::UNIX_EPOCH
and drop privateUNIX_SECONDS
constant. (#6908, thanks @j8r) - Change
Time::DayOfWeek
to ISO ordinal numbering based onMonday = 1
. (#6555, thanks @straight-shoota) - Refactor time specs. (#6574, thanks @straight-shoota)
- Add docs for singular method aliases, add
Int#microsecond
alias. (#6297, thanks @Sija)
Files
- (breaking-change) Remove
Tempfile
. UseFile.tempfile
orFile.tempname
. (#6485, thanks @straight-shoota) - Fixed missing closed status check of FDs when creating a subprocess. (#6641, thanks @Timbus)
- Fixed
ChecksumReader.write
error message. (#6889, thanks @r00ster91) - Add
File#delete
,Dir#tempdir
and improveFile
docs. (#6485, thanks @straight-shoota) - Add
File#fsync
to flush all data written into the file to the disk device. (#6793, thanks @carlhoerberg) - Add
DEVNULL
to docs. (#6642, thanks @r00ster91) - Improve checks for FreeBSD version due to breaking API changes. (#6629, thanks @myfreeweb)
- Improve performance of
Zlib::Reader
,Gzip::Reader
andFlate::Reader
by includingIO::Buffered
. (#6916, thanks @asterite) - Refactor
Crystal::System::FileDescriptor
to use@fd
ivar directly. (#6703, thanks @straight-shoota) - Refactor
{Zlib,Gzip,Flate}::Reader#unbuffered_rewind
to usecheck_open
. (#6958, thanks @Sija)
Networking
- (breaking-change) Remove deprecated alias
HTTP::Server#bind_ssl
. UseHTTP::Server#bind_tls
. (#6699, thanks @straight-shoota) - Add
Socket::Address#pretty_print
and#inspect
. (#6704, thanks @straight-shoota) - Add
Socket::IPAddress
loopback, unspecified and broadcast methods/constants. (#6710, thanks @straight-shoota) - Fixed
Socket#reuse_port?
ifSO_REUSEPORT
is not supported. (#6706, thanks @straight-shoota) - Fixed
TCPServer
handling ofreuse_port
. (#6940, thanks @RX14) - Add docs to demonstrate parameters for
HTTP::Client
. (#5145, thanks @HCLarsen) - Add docs examples to
Socket::Server#accept
. (#6705, thanks @straight-shoota) - Refactor
socket_spec.cr
into separate files. (#6700, thanks @straight-shoota) - Refactor specs of
HTTP::Client
to remove inheritance for test server. (#6909, thanks @straight-shoota) - Improve specs for
HTTP::Server#close
. (#5958, thanks @straight-shoota) - Improve specs for socket. (#6711, thanks @straight-shoota)
Crypto
- Fixed OpenSSL bindings to work with LibreSSL. (#6917, thanks @LVMBDV)
- Add support for OpenSSL 1.1.1. (#6738, thanks @ysbaddaden)
Concurrency
- Improve POSIX threads integration regarding locking, error and resource manag...
0.26.1
Language changes
Macros
Standard library
Macros
Collections
Serialization
- Fixed
JSON::Serializable
andYAML::Serializable
clashing with custom initializers. (#6458, thanks @kostya)
Time
- Fixed docs for
Time::Format
. (#6578, thanks @straight-shoota)
Files
Networking
- (deprecate)
HTTP::Server#bind_ssl
in favor ofHTTP::Server#bind_tls
. (#6551, thanks @bcardiff) - Add tls scheme to
HTTP::Server#bind
. (#6533, thanks @straight-shoota) - Fixed
HTTP::Server
crash with self-signed certificate. (#6590, thanks @bcardiff) - Refactor
HTTP::Server
specs to use free ports. (#6530, thanks @straight-shoota)
System
Spec
- Fixed
DotFormatter
to flush after every spec. (#6562, thanks @asterite) - Add support for Windows. (#6497, thanks @RX14)
Compiler
- Fixed evaluate yield expressions in macros. (#6587, thanks @asterite)
- Fixed presence check of named argument via external name. (#6560, thanks @asterite)
- Fixed parser error on
break when
. (#6509, thanks @asterite) - Fixed
~
methods are now able to be called asfoo.~
. (#6541, thanks @makenowjust) - Fixed parsing newline after macro control expression. (#6607, thanks @asterite)
- Refactor use enum instead of hardcoded string values for emit kinds. (#6515, thanks @bew)
Tools
Formatter
- Fixed formatting of newline before
&.method
in call. (#6535, thanks @makenowjust) - Fixed formatting of empty heredoc. (#6567, thanks @makenowjust)
- Fixed formatting of string literal in interpolation. (#6568, thanks @makenowjust)
- Fixed formatting of comments in case when. (#6595, thanks @asterite)
Doc generator
Playground
Others
- CI improvements and housekeeping. (#6550, #6612, thanks @bcardiff)
- Add
pkg-config
as Linux package dependency. (distribution-scripts#16, thanks @bcardiff)
0.26.0
Language changes
- (breaking-change) Revert do not collapse unions for sibling types. (#6351, thanks @asterite)
- (breaking-change) Constant lookup context in macro is now lexical. (#5354, thanks @makenowjust)
- (breaking-change) Evaluate instance var initializers at the metaclass level (ie: disallow using
self
). (#6414, thanks @asterite) - (breaking-change) Add
//
operator parsing. NB: No behaviour is assigned to this operator yet. (#6470, thanks @bcardiff) - Add
&+
&-
&*
&**
operators parsing. NB: No behaviour is assigned to these operators yet. (#6329, thanks @bcardiff) - Add support for empty
case
withoutwhen
. (#6367, thanks @straight-shoota)
Macros
- Add
pp!
andp!
macro methods. (#6374, #6476, thanks @straight-shoota)
Standard library
- Fix docs for
Pointer
. (#6494, thanks @fxn) - Fix docs of
UUID
enums. (#6496, thanks @r00ster91)
Numeric
- Fixed
Random#rand(Range(Float, Float))
to returnFloat
. (#6445, thanks @straight-shoota) - Add docs of big module overloads. (#6336, thanks @laginha87)
Text
- (breaking-change)
String#from_utf16(pointer : Pointer(UInt16))
returns now{String, Pointer(UInt16)}
. (#6333, thanks @straight-shoota) - Add support for unicode 11.0.0. (#6505, thanks @asterite)
- Add an optional argument to
String#check_no_null_byte
to customize error message. (#6333, thanks @straight-shoota) - Add
ECR.render
for rendering directly asString
. (#6371, thanks @straight-shoota) - Fix docs for
Char
(#6487, thanks @r00ster91)
Collections
- Add docs for
StaticArray
. (#6404, #6488, thanks @straight-shoota, @r00ster91, @hinrik) - Refactor
Array#concat
. (#6493, thanks @fxn)
Serialization
- (breaking-change) Add a maximum nesting level to prevent stack overflow on
YAML::Builder
andJSON::Builder
. (#6322, thanks @asterite) - Fixed compatibility for libyaml 0.2.1 regarding document end marker
...
. (#6287, thanks @straight-shoota) - Add methods and options for pull parsing or hybrid parsing to
XML::Reader
. (#5740, #6332, thanks @felixbuenemann) - Fixed docs for
JSON::Any
,JSON::Serialization
andYAML::Serialization
. (#6460, #6491, thanks @delef, @bmulvihill)
Time
- (breaking-change) Make location a required argument for
Time.parse
. (#6369, thanks @straight-shoota) - Add
Time.parse!
,Time.parse_utc
,Time.parse_local
. (#6369, thanks @straight-shoota) - Fix docs comment missing (#6387, thanks @faustinoaq)
Files
- (breaking-change) Remove
File.each_line
method that returns an iterator. UseIO#each_line
. (#6301, thanks @asterite) - Fixed
File.join
when path separator is a component argument. (#6328, thanks @icyleaf) - Fixed
Dir.glob
can now list broken symlinks. (#6466, thanks @straight-shoota) - Add
File
andDir
support for Windows. (#5623, thanks @RX14)
Networking
- (breaking-change) Drop
HTTP::Server#tls
in favor ofHTTP::Server#bind_ssl
. (#5960, thanks @straight-shoota) - (breaking-change) Rename alias
HTTP::Handler::Proc
toHTTP::Handler::HandlerProc
. (#6453, thanks @jwoertink) - Fixed
Socket#accept?
base implementation. (#6277, thanks @ysbaddaden) - Fixed performance issue due to unbuffered
IO
read.IO#sync
only affect writes, introduceIO#read_buffering?
. (#6304, #6474, thanks @asterite, @bcardiff) - Fixed handling of closed state in
HTTP::Server::Response
. (#6477, thanks @straight-shoota) - Fixed change encoding name comparison to be case insensitive for UTF-8. (#6355, thanks @asterite)
- Fixed support for quoted charset value in HTTP. (#6354, thanks @asterite)
- Fixed docs regarding udp example on
Socket::Addrinfo
. (#6388, thanks @faustinoaq) - Fixed
HTTP::Client
will setconnection: close
header on one-shot requests. (#6410, thanks @asterite) - Fixed
OpenSSL::Digest
for multibyte strings. (#6471, thanks @RX14) - Fixed missing
Host
header when usingHTTP::Client#exec
. (#6481, thanks @straight-shoota) - Add
HTTP::Server#bind(URI|String)
that infers protocol from scheme. (#6500, thanks @straight-shoota) - Add
HTTP::Params.new
andHTTP::Params#empty?
. (#6241, thanks @icyleaf) - Add support for multiple Etags in
If-None-Match
header forHTTP::Request
andHTTP::StaticFileHandler
. (#6219, thanks @straight-shoota) - Add IDNs normalization to punycode in
OpenSSL::SSL::Socket
. (#6306, thanks @paulkass) - Add
application/wasm
to the default MIME types ofHTTP::StaticFileHandler
. (#6377, thanks @makenowjust) - Add
URI#absolute?
andURI#relative?
. (#6311, thanks @mamantoha)
Crypto
- Fixed
Crypto::Bcrypt::Password#==
was hidingReference#==(other)
. (#6356, thanks @straight-shoota)
Concurrency
System
- Fixed raise
Errno
ifProcess.new
fails to exec. (#6501, thanks @straight-shoota, @lbguilherme) - Add support for
WinError
UTF-16 string messages. (#6442, thanks @straight-shoota) - Refactor platform specifics from
ENV
toCrystal::System::Env
and implement for Windows. (#6333, #6499, thanks @straight-shoota)
Spec
- Add TAP formatter to spec suite. (#6286, thanks @straight-shoota)
Compiler
- Fixed named arguments expansion from double splat clash with local variable names. (#6378, thanks @asterite)
- Fixed auto assigned ivars arguments expansions when clash with keywords. (#6379, thanks @asterite)
- Fixed resulting type of union of tuple metaclasses. (#6342, thanks @asterite)
- Fixed ICE when using unbound type parameter inside generic type. (#6292, thanks @asterite)
- Fixed ICE when using unions of metaclasses. (#6307, thanks @asterite)
- Fixed ICE related to literal type guessing and generic types hierarchy. (#6341, thanks @asterite)
- Fixed ICE related to
not
and inlinable values. (#6452, thanks @asterite) - Fixed rebind variables type in while condition after analyzing its body. (#6295, thanks @asterite)
- Fixed corner cases regarding automatic casts and method instantiation. (#6284, thanks @asterite)
- Fixed parsing of
\A
(and others) inside%r{...}
inside macros. (#6282, thanks @asterite) - Fixed parsing of of named tuple inside generic type arguments. ([#6413](https://github.com/crystal-lang/crystal/pull...
0.25.1
Standard library
Macros
- Fixed
Object.delegate
is now able to be used with[]=
methods. (#6178, thanks @straight-shoota) - Fixed
p!
pp!
are now able to be used with tuples. (#6244, thanks @bcardiff) - Add
#copy_with
method to structs generated byrecord
macro. (#5736, thanks @chris-baynes) - Add docs for
ArrayLiteral#push
and#unshift
. (#6232, thanks @makenowjust)
Collections
- Add docs for
Indexable#zip
and#zip?
methods. (#5734, thanks @rodrigopinto)
Serialization
- Add
#dup
and#clone
forJSON::Any
andYAML::Any
. (6266, thanks @asterite) - Add docs example of nesting mappings to
YAML.builder
. (#6097, thanks @kalinon)
Time
- Fixed docs regarding formatting and parsing
Time
. (#6208, #6214, thanks @r00ster91 and @straight-shoota) - Fixed
Time
internals for future windows support. (#6181, thanks @RX14) - Add
Time::Span#microseconds
,Int#microseconds
andFloat#microseconds
. (#6272, thanks @asterite) - Add specs. (#6174, thanks @straight-shoota)
Files
- Fixed
File.extname
edge case. (#6234, thanks @bcardiff) - Fixed
FileInfo#flags
return value. (#6248, thanks @fgimian)
Networking
- Fixed
IO#write(slice : Bytes)
won't write information if slice is empty. (#6269, thanks @asterite) - Fixed docs regarding
HTTP::Server#bind_tcp
method. (#6179, #6233, thanks @straight-shoota and @makenowjust) - Add Etag support in
HTTP::StaticFileHandler
. (#6145, thanks @emq)
Misc
- Fixed
mmap
usage on OpenBSD 6.3+. (#6250, thanks @jcs) - Fixed
big/big_int
,big/big_float
, etc are now able to be included directly. (#6267, thanks @asterite) - Refactor dependency in
Crystal::Hasher
to avoid load order issues. (#6184, thanks @ysbaddaden)
Compiler
- Fixed a leakage of unbounded generic type variable and show error. (#6128, thanks @asterite)
- Fixed error message when lookup of library fails and lib's name contains non-alpha chars. (#6187, thanks @oprypin)
- Fixed integer kind deduction for very large negative numbers. (#6182, thanks @rGradeStd)
- Refactor specs tempfiles and data files usage in favor of portability (#5951, thanks @straight-shoota)
- Improve formatting and information in some compiler error messages. (#6261, thanks @RX14)
Tools
Formatter
- Fixed crash when semicolon after block paren were present. (#6192, thanks @makenowjust)
- Fixed invalid code produced when heredoc and comma were present. (#6222, thanks @straight-shoota and @makenowjust)
- Fixed crash when one-liner
begin
/rescue
were present. (#6274, thanks @asterite)
Doc generator
- Fixed JSON export that prevent jumping to constant. (#6218, thanks @straight-shoota)
- Fixed crash when virtual types were reached. (#6246, thanks @bcardiff)
Misc
0.25.0
New features and breaking changes
- (breaking-change) Time zones has been added to
Time
. (#5324, #5819, thanks @straight-shoota) - (breaking-change) Drop
HTTP.rfc1123_date
in favor ofHTTP.format_time
and add time format implementations for ISO-8601, RFC-3339, and RFC-2822. (#5123, thanks @straight-shoota) - (breaking-change)
crystal deps
is removed, useshards
. (#5544, thanks @asterite) - (breaking-change)
Hash#key
was renamed asHash#key_for
. (#5444, thanks @marksiemers) - (breaking-change)
JSON::Any
andYAML::Any
have been re-implemented solving some inconsistencies and avoiding the usage of recursive aliases (JSON::Type
andYAML::Type
have been removed). (#5183, thanks @asterite) - (breaking-change) Multiple heredocs can be used as arguments and methods can be invoked writing them in the initial delimiter, also empty heredocs are now supported. (#5578, #5602, #6048, thanks @asterite and @makenowjust)
- (breaking-change) Refactor signal handlers and avoid closing pipe at exit. (#5730, thanks @ysbaddaden)
- (breaking-change) Improve behaviour of
File.join
with empty path component. (#5915, thanks @straight-shoota) - (breaking-change) Drop
Colorize#push
in favor ofColorize#surround
and allow nested calls across the stack. (#4196, thanks @makenowjust) - (breaking-change)
File.stat
was renamed toFile.info
and a more portable API was implemented. (#5584, #6161, thanks @RX14 and @bcardiff) - (breaking-change) Refactor
HTTP::Server
to bind to multiple addresses. (#5776, #5959, thanks @straight-shoota) - (breaking-change) Remove block argument from
loop
. (#6026, thanks @asterite) - (breaking-change) Do not collapse unions for sibling types. (#6024, thanks @asterite)
- (breaking-change) Disallow
typeof
in type restrictions. (#5192, thanks @asterite) - (breaking-change) Perform unbuffered read when
IO::Buffered#sync = true
. (#5849, thanks @RX14) - (breaking-change) Drop
when _
support. (#6150, thanks @makenowjust) - (breaking-change) The
DivisionByZero
exception was renamed toDivisionByZeroError
. (#5395, thanks @sdogruyol) - A bootstrap windows port has been added to the standard library. It's not usable for real programs yet. (#5339, #5484, #5448, thanks @RX14)
- Add automatic casts on literals arguments for numbers and enums. (#6074, thanks @asterite)
- Add user defined annotations. (#6063, #6084, #6106, thanks @asterite)
- Add macro verbatim blocks to avoid nested macros. (#6108, thanks @asterite)
- Allow namespaced expressions to define constants eg:
Foo::Bar = 1
. (#5883, thanks @bew) - Allow trailing
=
in symbol literals. (#5969, thanks @straight-shoota) - Allow redefining
None
to0
for@[Flags]
enum. (#6160, thanks @bew) - Suggest possible solutions to failing requires. (#5487, thanks @RX14)
- Allow pointers of external C library global variables. (#4845, thanks @larubujo)
- Decouple pretty-printing (
pp
) and showing the expression (!
):p
,pp
,p!
,pp!
. (#6044, thanks @asterite) - Add ivars default value reflection in macros. (#5974, thanks @asterite)
- Add argless overload to
Number#round
to rounds to the nearest whole number. (#5397, thanks @Sija) - Add
Int#bits_set?
to easily check that certain bits are set. (#5619, thanks @RX14) - Add
Float32
andFloat64
constants. (#4787, thanks @konovod) - Add allocated bytes per operation in
Benchmark.ips
. (#5522, thanks @asterite) - Add
String#to_utf16
andString.from_utf16
. (#5541, #5579, #5583 thanks @asterite, @RX14 and @straight-shoota) - Add
String#starts_with?(re: Regex)
. (#5485, thanks @makenowjust) - Add
Regex.needs_escape?
. (#5962, thanks @Sija) - Add
Hash#last_key
andHash#last_value
. (#5760, thanks @j8r) - Add no-copy iteration to
Indexable
. (#4584, thanks @cjgajard) - Add
Time#at_{beginning,end}_of_second
(#6167, thanks @straight-shoota) - Add
IO::Stapled
to combine two unidirectionalIO
s into a single bidirectional one. (#6017, thanks @straight-shoota) - Add context to errors in
JSON.mapping
generated code. (#5932, thanks @straight-shoota) - Add
JSON::Serializable
andYAML::Serializable
attribute powered mappings. (#6082, thanks @kostya) - Add
mode
param toFile.write
. (#5754, thanks @woodruffw) - Add Punycode/IDNA support and integrate with DNS lookup. (#2543, thanks @makenowjust)
- Add
HTTP::Client#options
method. (#5824, thanks @mamantoha) - Add support for
Last-Modified
and other cache improvements toHTTP::StaticFileHandler
. (#2470, #5607, thanks @bebac and @straight-shoota) - Add operations and improvements related to
BigDecimal
andBigFloat
. (#5437, #5390, #5589, #5582, #5638, #5675, thanks @Sija and @mjago) - Add
BigDecimal
andUUID
JSON support. (#5525, #5551, thanks @lukeasrodgers and @lachlan) - Add missing
UUID#inspect
. (#5574, thanks @ngsankha) - Add
Logger
configuration in initializer. (#5618, thanks @Sija) - Add custom separators in
CSV.build
. (#5998, #6008 thanks @Sija) - Add
INI.build
to emitINI
files. (#5298, thanks @j8r) - Add
Process.chroot
. (#5577, thanks @chris-huxtable) - Add
Tempfile.tempname
to create likely nonexisting filenames. (#5360, thanks @woodruffw) - Add
FileUtils#ln
,ln_s
, andln_sf
. (#5421, thanks @woodruffw) - Add support 8bit and true color to
Colorize
. (#5902, thanks @makenowjust) - Add comparison operators between classes. (#5645, thanks @asterite)
- Add exception cause in backtrace. (#5833, thanks @RX14)
- Add unhandled exception as argument in
at_exit
. (#5906, thanks @makenowjust) - Add support to target aarch64-linux-musl. (#5861, thanks @jirutka)
- Add
#clear
method toArrayLiteral
/HashLiteral
for macros. (#5265, thanks @Sija...