Crystal 1.22.0 Is Released
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-linux promoted 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 This 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 Below we list the most remarkable changes in the language, compiler, and stdlib. For more details, visit the full changelog. Breaking: Exit on pipe error Crystal 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 Constants 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 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 Process.fork had been deprecated sine before 1.0 and now we finally removed it (#17367) Thanks, @straight-shoota New Macros New macros enable more text operations at compile time: StringLiteral#bytesize (#17176), NumberLiteral#chr (#17169) and RangeLiteral#each supports CharLiteral (#17170) Thanks, @straight-shoota Compiler New constants Crystal::ALL_FLAGS and Crystal::USER_FLAGS provide access to the compile time flags (#17392). Thanks, @straight-shoota DWARF refactor We 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
and DW_FORM_strx
(#17445). Thanks, @ysbaddaden HTTP improvements We merged numerous improvements and bug fixes for HTTP. #remote_address and #local_address moved from HTTP::Request to HTTP::Context (#17196) Add HTTP::Headers#merge (#17326) Serialize IO::Memory in HTTP body with Content-Length header (#17388) Bug fixes: Reject unrecognized HTTP Transfer-Encoding header (#17140), invalid Content-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_body to not raise with without_zlib (#17272) Validate properties of HTTP::WebSocketHandler (#17235), HTTP::Request (#17255,#17304, #17374, #17310, #17312, #17258), HTTP::Headers name (#17317) Close HTTP::Client on IO::Error during request (#17318) Fix Content-Encoding: deflate (#17261) Fix HTTP::Request.from_io parsing empty header name (#17254) Fix HTTP::Request#form_params? to ignore invalid content-type (#17256) Thanks @straight-shoota, @hahwul, @jgaskins, @Sija Eventloop All 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 We finally enabled support for Kernel TLS in the OpenSSL bindings by default (#17059) Thanks, @ysbaddaden Misc File.exists? (#17307), as well as File::Info.readable?, .writable?, .executable? now receive a follow_symlinks: false argument(#17391) Add Char::Reader.new(Bytes) (#17428) Add Time::Span#to_nanoseconds etc. (#17190) Add GC.syscall(&) (#17150) Fixed backtraces when linking with -static-pie on musl-libc (#17316) Thanks, @straight-shoota, @ysbaddaden Deprecations Uppercase instance and class variables (#17160) HTTP::Request#local_address and #remote_address (#17260) LLVM::Type#size and #alignment (#17494) Dependencies Support for LLVM 23.1 and 24.0 (#17432) Updated markd 0.6.0 (#17269) Thanks, @straight-shoota, @hertzdevil Packages Updated 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 Crystal 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!