Crystal 1.21.0
Crystal 1.21.0 just landed — and I've been digging through the changelog so you don't have to. This is a meaningful minor release with breaking changes, new language features, and some solid quality-of-life improvements across the stdlib.
Breaking Changes You Need to Know
Let's start with what will break, because nobody likes surprise CI failures.
- Execution Contexts (runtime): The runtime now releases execution contexts properly. If you're doing anything with fibers or concurrency, review the upstream changes in PRs #17100 and #17104 before upgrading.
- PCRE fallback disabled: The automatic fallback to legacy PCRE in the
textmodule has been removed. If you were relying on this for regex operations, you'll need to ensure your system has PCRE2 available. This has been on the deprecation path for a while — now it's enforced.
New Language Features
There are some genuinely nice additions here that make Crystal even more pleasant to write.
%Wpercent string array literals with interpolation — a natural companion to the existing%wliteral. Perfect for when you need an array of strings with embedded expressions.TypeNode#all_methodsmacro — this includes methods from ancestor types, making macro-based metaprogramming much more powerful. If you build libraries, you'll want this.
Stdlib Highlights
The standard library got some serious love in this release. Here are the standouts:
- Channel is now an Iterator —
Channel(T)implementsIterator(T), which makes working with channels in loops much cleaner. - OpenSSL 4.0 support — Crystal now supports the latest OpenSSL, including 4.x DLLs on Windows MSVC. Forward-looking and practical.
Socket#sendfile(experimental) — zero-copy file sending over sockets. This is a big deal for performant servers.HTTP::WebSocket#receive— synchronous WebSocket receive calls. No more callback spaghetti for simple use cases.String#present?— finally, a clean way to check if a string is non-empty and non-blank.- UUID v6 and v8 generators — more UUID variants for when you need time-ordered or custom identifiers.
Should You Upgrade?
If you're on Crystal 1.20.x, the upgrade to 1.21.0 is worth doing — but don't rush it blindly. The PCRE fallback removal will hit you if you deploy on minimal Docker images that only have PCRE. The execution contexts change is subtle but could affect concurrent code. Run your full test suite, check for warnings, and you'll be fine. Verdict: upgrade, but with a migration branch first.
Full changelog and downloads on GitHub.