Sigil 0.22.5
A regular expressions and web reliability release, plus Windows icons. Sigil now has regular expressions in the standard library. Web builds could also fail in ways nothing on the code path explained: a type error from nowhere, or text that parsed fine natively coming back as garbage. Crash The Stack hit both, including a menu that froze on phones.
Existing projects build without changes. A native or wasm app picks up the fixes by rebuilding with this toolchain. (sigil regex) and (sigil unicode case) are new, and a Windows build config gains two optional keys.
Regular expressions: (sigil regex)
Sigil now has regular expressions in the standard library, using the same syntax as RE2 and Go. regex-match?, regex-search, regex-replace-all, regex-split and the rest take either a compiled pattern or a plain string, so a one-off check is a single call.
Matching always runs in linear time, so no pattern can hang your program, even one you didn't write. The trade-off is that a pattern can't refer back to its own groups (backreferences like \1) or use lookaround, and such patterns are rejected with an error pointing at the position. Replacements can still use captured groups: $1 and ${name} work in regex-replace and regex-replace-all.
The module is plain Sigil, so it behaves the same on bytecode, native and WebAssembly. Shell scripts get it without an import:
(unless (regex-match? "^v[0-9]+\\.[0-9]+\\.[0-9]+$" tag)
(error "not a release tag" tag))Tail calls keep their arguments alive
A tail call into a built-in procedure could lose its arguments to the garbage collector while the built-in was still using them. Reading from a fresh string port was the usual victim: a large parse failed partway through with a type error or a reader error on text that was fine.
Only web builds showed it, and only when a collection happened to land mid-call, so the same code could work in one build and fail in the next. Rebuilding with 0.22.5 fixes it.
Deep recursion no longer loses values
Recursion more than 1024 native frames deep could leave the innermost frames unprotected from the garbage collector. Values still in use could be freed, and the next operation to touch them failed with an unrelated type error. The limit is gone: the frame stack now grows as needed.
Catching memory errors in web builds
SIGIL_GC_POISON_FREE=1 fills freed memory with a marker pattern, so a use-after-free fails right away instead of at some random later point. The GC's other environment variables, such as SIGIL_GC_STRESS, now reach a wasm module when its host supplies them.
Case mapping that matches on every platform
char-upcase and char-downcase depend on the C library the runtime was linked against, so é could uppercase in one build and not in another. The new (sigil unicode case) carries the Unicode 15 case tables itself and gives the same answer everywhere. Case-insensitive regex matching uses it.
Windows executables get an icon and version details
A Windows config in your project's package file can now set the exe icon for sigil build with icon:, pointing at a .ico file in your project. The exe also gets its Properties → Details tab filled in from your package's version: and author, and the new optional product-name:.
(config
name: 'windows-amd64
toolchain: 'zig
target: "x86_64-windows-gnu"
backend: 'native
icon: "windows/app.ico"
product-name: "My Game")A missing or invalid icon fails the build with a clear message instead of quietly shipping without one. Configs that don't use these keys build exactly as before.