My penguin avatar

Kiesel Devlog #6: Catching up :^)

Published on 2024-01-29.

Happy new year! Well, new is a stretch, but it's been a while since I last did one of these. This post is gonna be all over the place, but I want to get you up to speed before focusing on more specific things again :^)


The last (exactly!) three months can be summed up as follows:

Let's take a closer look :^)

A Better REPL

I already hinted towards this in the last devlog:

CxByte managed to yakbait himself into writing a line editor in Zig and kindly integrated it into Kiesel's REPL!

It still had a bug or two early on but things seem stable now — if you happen to notice any issues, please report them upstream.

Additionally, I added a preamble to the REPL to make it more informative instead of dropping you into a prompt right away:

$ kiesel
Kiesel 0.1.0 [Zig 0.12.0-dev.2341+92211135f] on linux
Use Ctrl+D to exit.

macOS CI Builds

Zig is excellent at cross compiling for other targets, but for the longest time I didn't add macOS CI builds because libgc includes mach-o/getsect.h from the macOS SDK, which needs to be installed on the build host. Vendoring the file didn't seem desirable, so I simply ignored the problem — macOS users could still build from source.

After finding and integrating this Zig package, the problem solved itself and there is now a kiesel-macos-aarch64 build on!

Thanks to Andrew for fixing the build after I unknowingly broke it, which lead to me thinking about this again :^)


This is a new function (stage 4 in November 2023) that implements the commonly used deferred promise pattern. The proposal was championed by a colleague of mine, and I ended up contributing the upstream TypeScript definitions to help getting it ready for production use.

The spec text is seven lines so I resisted writing an implementation myself, knowing it could be a good first task for someone wanting to contribute to Kiesel — and it was! At 37c3 Domi and I sat down and did some Zig hacking together :^)

Atomics, DataView, TypedArray

I finally got around to implementing these three:


ECMA-402 (aka Intl) was never that high on my list of priorities for Kiesel (and still isn't), but it's nice to have those APIs I suppose!

Unlike LibJS I opted to not implement my own ICU replacement and chose ICU4X instead (using their C API as ICU4X is written in Rust 🦀).

Generally speaking you can get away with using C APIs in Zig directly, but in this case the code looked horrendous:

I decided to write a simple wrapper as a standalone library — and that's how icu4zig was born!

So far I've used it to implement locale handling, adding other objects will require more work on icu4zig first.

Expand to see the full list of newly implemented Intl builtins 📝

Annex B Has Joined the Chat

B Additional ECMAScript Features for Web Browsers

The ECMAScript language syntax and semantics defined in this annex are required when the ECMAScript host is a web browser. The content of this annex is normative but optional if the ECMAScript host is not a web browser.

Implementing it means:

Jokes aside, while these language features are hopefully not being relied upon in new code, there's existing JS out there that needs them. I've added a compile time flag to make them opt out (-Denable-annex-b=false), and given the implementation is not too invasive I'm happy to have it around :^)

So far this includes builtins and and the [[IsHTMLDDA]] internal slot (if you don't know what that means: good for you!), but none of the syntax changes.

Expand to see the full list of newly implemented Annex B builtins 📝

Performance 🚀🚀🚀

While Kiesel remains largely unoptimized — make it work, make it right (we are here), make it fast — I've finally started profiling and implemented some quick wins:

In general, optimizing is both necessary and heaps of fun, so I'll definitely do more of that! Special shout-out to CanadaHonk who was the source of yakbait for most of these while benchmarking against Porffor :^)


Not much happened here and you still can't fully import modules in Kiesel, but I got some basics up and running:


A few other bits that I didn't mention yet:

Expand to see the full list of newly implemented builtins 📝

Thanks for reading, until next time! :^)

Loading posts...