Crystal 1.22.0 is released!
Highlights
- Standard streams emulate SIGPIPE stdlib/runtime
- Revamped DWARF parsing for performance stdlib/runtime
- All targets support native event loop stdlib/runtime
- Support for LLVM 23 & 24 stdlib/llvm
-
aarch64-linuxpromoted to Tier 1 platform/linux
We are announcing a new Crystal release 1.22.0 with several new features and bug fixes.
Pre-built packages are available on GitHub Releases and our official distribution channels. See crystal-lang.org/install for installation instructions.
Stats
Section titled StatsThis release includes 251 changes since 1.21.1 by 33 contributors. We thank all the contributors for all the effort put into improving the language! ❤️
Changes
Section titled ChangesBelow we list the most remarkable changes in the language, compiler, and stdlib. For more details, visit the full changelog.
Breaking: Exit on pipe error
Section titled Breaking: Exit on pipe errorCrystal processes exit immediately when writing to STDOUT or STDERR fails with EPIPE.
This closely resembles the default behaviour of the SIGPIPE signal.
Previously, the failing write would raise IO::Error, which typically prints
an error message and exits. This error message is now removed (#17335).
You can opt out of this behaviour with STDOUT.exit_on_broken_pipe = false.
Thanks, @straight-shoota
Constants with type declarations
Section titled Constants with type declarationsConstants can have type declarations (#16951). They work exactly as you would expect the combination of constants and type declarations to be.
module Foo
BAR : Int32 = 1
BAZ : String = ""
QUX : Int64 = 123 # autocasts 123 to Int64
end
Thanks, @stakach
aarch64-linux promoted to Tier 1
Section titled aarch64-linux promoted to Tier 1
The targets aarch64-linux-gnu and aarch64-linux-musl moved from Tier 2 to Tier 1.
The only missing piece was that we were lacking official builds, but we have that since 1.19.
Breaking: Process.fork removed
Section titled Breaking: Process.fork removed
Process.fork had been deprecated sine before 1.0 and now we finally removed it (#17367)
Thanks, @straight-shoota
New Macros
Section titled New Macros- New macros enable more text operations at compile time:
StringLiteral#bytesize(#17176),NumberLiteral#chr(#17169) andRangeLiteral#eachsupportsCharLiteral(#17170)
Thanks, @straight-shoota
Compiler
Section titled CompilerNew constants Crystal::ALL_FLAGS and Crystal::USER_FLAGS provide access to the compile time flags (#17392).
Thanks, @straight-shoota
DWARF refactor
Section titled DWARF refactorWe completely revamped DWARF parsing to enhance performance and reduce memory usage. The DWARF parser now scans sections on demand (#17283) and builds an efficient index table once (#17410, #17455), which results in blazingly fast look ups. Decoded backtrace lines are cached in an LRU cache (#17285).
Also added aupport for DWARF 5 features DW_FORM_addrx<n> and DW_FORM_strx<n> (#17445).
Thanks, @ysbaddaden
HTTP improvements
Section titled HTTP improvementsWe merged numerous improvements and bug fixes for HTTP.
#remote_addressand#local_addressmoved fromHTTP::RequesttoHTTP::Context(#17196)- Add
HTTP::Headers#merge(#17326) - Serialize
IO::Memoryin HTTP body withContent-Lengthheader (#17388)
Bug fixes:
- Reject unrecognized HTTP
Transfer-Encodingheader (#17140), invalidContent-Encoding(#17262), and invalid HTTP trailer (#17337) - [breaking] Fix the return values of
HTTP::Request#body=and#content_length=(#17257, #17273) - Fix
HTTP.parse_headers_and_bodyto not raise withwithout_zlib(#17272) - Validate properties of
HTTP::WebSocketHandler(#17235),HTTP::Request(#17255,#17304, #17374, #17310, #17312, #17258),HTTP::Headersname (#17317) - Close
HTTP::ClientonIO::Errorduring request (#17318) - Fix
Content-Encoding: deflate(#17261) - Fix
HTTP::Request.from_ioparsing empty header name (#17254) - Fix
HTTP::Request#form_params?to ignore invalid content-type (#17256)
Thanks @straight-shoota, @hahwul, @jgaskins, @Sija
Eventloop
Section titled EventloopAll targets support a native event loop based directly on the system selector and use it by default.
We enabled epoll on Solaris (#17370) and kqueue on all remaining BSD targets (#17421, #17420).
libevent is still available as a fallback, but now it’s strictly opt-in and becoming technically obsolete. We expect to deprecate in a following release.
Thanks, @ysbaddaden
KernelTLS
Section titled KernelTLSWe finally enabled support for Kernel TLS in the OpenSSL bindings by default (#17059)
Thanks, @ysbaddaden
Misc
Section titled MiscFile.exists?(#17307), as well asFile::Info.readable?,.writable?,.executable?now receive afollow_symlinks: falseargument(#17391)- Add
Char::Reader.new(Bytes)(#17428) - Add
Time::Span#to_nanosecondsetc. (#17190) - Add
GC.syscall(&)(#17150) - Fixed backtraces when linking with
-static-pieon musl-libc (#17316)
Thanks, @straight-shoota, @ysbaddaden
Deprecations
Section titled Deprecations- Uppercase instance and class variables (#17160)
HTTP::Request#local_addressand#remote_address(#17260)LLVM::Type#sizeand#alignment(#17494)
Dependencies
Section titled DependenciesThanks, @straight-shoota, @hertzdevil
Packages
Section titled PackagesUpdated distribution-scripts (#17178) brings upgrades of package dependencies, docker base images etc.
Thanks, @straight-shoota
This is the first release featuring builds for aarch64-windows-msvc.
Thanks, @hertzdevil
Maintainers
Section titled MaintainersCrystal established a forward compatibility policy in RFC 30: Building Crystal 1.22 requires a stage-0 compiler at 1.14 or higher.
We have been able to do all of this thanks to the continued support of 84codes and all other sponsors. To maintain and increase the development pace, donations, and sponsorships are essential. OpenCollective is available for that.
Reach out to crystal@manas.tech if you’d like to become a direct sponsor or find other ways to support Crystal. We thank you in advance!
Contribute