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, thanks @straight-shoota)
Crypto
- (breaking-change) Use
OpenSSL::Algorithm
instead of symbols fordigest
/hexdigest
. Expose LibCrypt'sPKCS5_PBKDF2_HMAC
. (#7264, thanks @mniak)
Concurrency
- Add multi-threading ready GC when compiling with
-D preview_mt
. (#7546, thanks @bcardiff, @waj, and @ysbaddaden) - Ship patched bdw-gc for multi-threading support. (#7622, thanks @bcardiff, and @ysbaddaden)
- Refactor to extract
Fiber::StackPool
fromFiber
. (#7417, thanks @ysbaddaden) - Refactor
IO::Syscall
asIO::Evented
. (#7505, thanks @ysbaddaden)
System
- Add command and args to
execvp
error message. (#7511, thanks @straight-shoota) - Refactor signals handling in a separate fiber. (#7469, thanks @asterite)
Spec
- Improve how running specs are cancelled upon
CTRL+C
. (#7426, thanks @asterite) - Allow
pending
andit
to accept constants. (#7646, thanks @straight-shoota)
Compiler
- (performance) Avoid fork and spawn when
--threads=1
. (#7397, thanks @asterite) - Fix exception type thrown on missing require. (#7386, thanks @asterite)
- Fix ICE when assigning a constant inside a multi-assign. (#7468, thanks @asterite)
- Fix parsing and behaviour of
->foo.[]
and other operators . (#7334, thanks @asterite) - Fix parsing bug in
asm
with 3 colons and a variable. (#7627, thanks @r00ster91) - Opt-in detection of calls to
@[Deprecated]
methods. (#7596, #7626, #7661, thanks @bcardiff) - Add
CRYSTAL_LIBRARY_PATH
for lookup static libraries. (#7562, thanks @bcardiff) - Improve error messages by adding the scope (and
with ... yield
scope, if any) on undefined method error. (#7384, thanks @asterite) - Suggest
next
when trying to break from captured block . (#7406, thanks @r00ster91) - Add detection of linux environment in compiler config. (#7479, thanks @straight-shoota)
- Pending leftovers to support
//
and&
-ops in multiple places. (#7628, thanks @bcardiff) - Refactor
Crystal::Config.version
to useread_file
macro. (#7081, thanks @Sija) - Rewrite macro spec without executing a shell command. (#6962, thanks @asterite)
- Fix typo in internals. (#7592, thanks @toshokan)
Language semantics
- Fix issues with
as
,as?
and unions and empty types. (#7475, thanks @asterite) - Fix method lookup when restrictions of instantiated and non-instantiated generic types are used. (#7537, thanks @bew)
- Fix method lookup when free vars and explicit types are used. (#7536, #7580, thanks @bew)
- When declaring a
protected initialize
, define a protectednew
. (#7510, thanks @asterite) - Fix named args type matching. (#7529, thanks @asterite)
- Merge procs with the same arguments type and
Nil | T
return type toNil
return type. (#7527, thanks @asterite) - Fix passing recursive alias to proc. (#7568, thanks @asterite)
Tools
Formatter
- Fix formatting of
1\n.as(Int32)
. (#7347, thanks @asterite) - Fix formatting of nested array elements. (#7450, thanks @makenowjust)
- Fix formatting of comments and enums. (#7605, thanks @asterite)
- Fix CLI handling of absolute paths input. (#7560, thanks @RX14)
Doc generator
- Don't include private constants. (#7575, thanks @r00ster91)
- Include Crystal built-in constants. (#7623, thanks @bcardiff)
- Add compile-time flag to docs generator. (#6668, #7438, thanks @straight-shoota)
- Display deprecated label when
@[Deprecated]
is used. (#7653, thanks @bcardiff)
Playground
Others
- CI improvements and housekeeping. (#7359, #7381, #7388, #7387, #7390, #7622, thanks @bcardiff)
- Smoke test linux 64 bits package using docker image recent build. (#7389, thanks @bcardiff)
- Mention git pre-commit hook in
CONTRIBUTING.md
. (#7617, thanks @straight-shoota) - Fix misspellings throughout the codebase. (#7361, thanks @Sija)
- Use chars instead of strings throughout the codebase. (#6237, thanks @r00ster91)
- Fix GC finalization warning in
Thread
specs. (#7403, thanks @asterite) - Remove generated docs from linux packages. (#7519, thanks @straight-shoota)