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#annotationsto list all annotations and not just the last of each kind. (#7326, thanks @Blacksmoke16) - Add
ArrayLiteral#sort_bymacro method. (#3947, thanks @jreinert)
Standard library
- (breaking-change) Allow creating
Noneenum 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.resetnot clearing previous handler. (#7409, thanks @asterite) - Add lazy versions of
Object.getter?andObject.property?macros. (#7322, thanks @Sija) - Allow returning other values than
-1,0and1byComparable#<=>. (#7277, thanks @r00ster91) - Add missing
requirestatements 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
$errnoGLIBC_PRIVATE symbol. (#7496, thanks @felixvf) - Refactor to have similar signatures accross the stdlib for
#to_sand#inspect. (#7528, thanks @wontruefree)
Numeric
- (breaking-change) Add deprecation message to
Int#/. It will return aFloatin0.29.0. UseInt#//for integer division. (#7639, thanks @bcardiff) - Change
Number#inspectto not show the type suffixes. (#7525, thanks @asterite) - Add
Int#leading_zeros_countandInt#trailing_zeros_count. (#7520, thanks @Sija) - Add
Big*#//,BigInt#&-ops and missing#floor,#ceil,#trunc. (#7638, thanks @bcardiff) - Improve
OverflowErrormessage. (#7375, thanks @r00ster91)
Text
- (performance) Optimize
String#comparein 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
optionsargument toString#camelcaseandString#underscore. (#7374, thanks @r00ster91) - Add docs to
Unicode::CaseOptions. (#7513, thanks @r00ster91) - Improve specs and docs for
String#each_lineandIO#each_line. (#7419, thanks @straight-shoota)
Collections
- (breaking-change) Let
Array#sortonly use<=>, and let<=>returnnilfor partial comparability. (#6611, thanks @asterite) - (breaking-change) Drop
Iterator#rewind. Implement#cycleby storing elements in an array. (#7440, thanks @asterite) - (performance) Add
Enumerable#each_conssupport forDequeas a reuse buffer. (#7233, thanks @yxhuvud) - (performance) Change
Range#bsearch/ 2to>> 1for faster performance. (#7531, thanks @Fryguy) - Fix
Slice#clonefor non-primitive types and deep copy. (#7591, thanks @straight-shoota) - Move
Indexable#zipandIndexable#zip?toEnumerableand make it work with any number ofIndexableorIterableorIterator. (#7453, thanks @asterite) - Add
Slice#[](Range). (#7439, thanks @asterite) - Add nillable range fetching
#[]?(Range)toArrayandString. (#7338, thanks @j8r) - Add
Set#add?. (#7495, thanks @Sija) - Improve documentation of
Hashregarding ordering of items. (#7594, thanks @straight-shoota)
Serialization
- (breaking-change) Change return type of
YAML#libyaml_versiontoSemanticVersion. (#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
Timeconstructors. DeprecateTime.nowto encourage usageTime.utcorTime.local(#5346, #7586, thanks @straight-shoota) - (breaking-change) Rename
Time#add_spantoTime#shiftfor changing a time instance by calendar units and handle other units. (#6598, thanks @straight-shoota) - (breaking-change) Change
Time#dateto return aTupleof{year, month, day}. UseTime#at_beginning_of_dayif aTimeinstance is wanted. (#5822, thanks @straight-shoota) - Fix Windows monotonic time bug. (#7377, thanks @domgetter)
- Refactor
Timemethods. (#6581, thanks @straight-shoota)
Files
- (breaking-change) Remove
IO#flush_on_newlineand onlysynconSTDOUT/STDIN/STDERRwhen they are TTY devices. (#7470, thanks @asterite) - Add
Pathtype. (#5635, thanks @straight-shoota)
Networking
-
(breaking-change) Move
HTTP::MultiparttoMIME::Multipart. (#7085, thanks @m1lt0n) -
(breaking-change) Stop parsing JSON in OAuth2 errors. (#7467, thanks @asterite)
-
(breaking-change) Fix
RequestProcessorconnection 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
URIimplementation.URI#opaquemethod is merged intoURI#path, which no longer returnsNil.#parse/#to_snormalization 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::StatusandResponse#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_readableandIO::Syscall#wait_writable. (#7366, thanks @stakach) -
Fix spec of
HTTP::Clientto not write server response after timeout. (#7402, thanks @asterite) -
Fix spec of
TCP::Serverfor musl. (#7484, thanks @straight-shoota)
Crypto
- (breaking-change) Use
OpenSSL::Algorithminstead 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::StackPoolfromFiber. (#7417, thanks @ysbaddaden) - Refactor
IO::SyscallasIO::Evented. (#7505, thanks @ysbaddaden)
System
- Add command and args to
execvperror 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
pendinganditto 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
asmwith 3 colons and a variable. (#7627, thanks @r00ster91) - Opt-in detection of calls to
@[Deprecated]methods. (#7596, #7626, #7661, thanks @bcardiff) - Add
CRYSTAL_LIBRARY_PATHfor lookup static libraries. (#7562, thanks @bcardiff) - Improve error messages by adding the scope (and
with ... yieldscope, if any) on undefined method error. (#7384, thanks @asterite) - Suggest
nextwhen 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.versionto useread_filemacro. (#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 | Treturn type toNilreturn 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
Threadspecs. (#7403, thanks @asterite) - Remove generated docs from linux packages. (#7519, thanks @straight-shoota)