Jupyter kernel for Zig

Jupyter is a system (client ↔ server ↔ kernel) for interactive computing made popular by Python, now seeing use by many languages including several languages including LLVM-based ones like C++. Especially because of the comptime facility in Zig, I was curious what if any possibility to have such a kernel exists? E.g. if hte compiler or language server exposes an API for code evaluation, then it would be straightforward to target; alternatively, one could use the same approach as in the Cling kernel for C++.

(I should go read Zig’s source code of course but curious if it’s interesting to others as well).


You know, I do enjoy working in jupyter sometimes. It’s nice to sketch out ideas and preview data.

One of the biggest hurdles to an idea like this is incremental compilation. If I wanted to re-run a code block without very advanced incremental compilation, I’d have to recompile the entire source. At that point, it’s debatable if we’re getting the benefit of code blocks.

I think what you’d end up with is a syntax that closely mirrors zig, but would essentially be python (lol). However! That’s not a terrible idea - it’s just a lot of work and a very different design philosophy (especially with comptime stuff… compiling that dynamically would be… interesting…).

There are some hacks for doing this (REPL’s for instance) but they pretty much do what I was outlining above. You’d probably need to have some external data structure that works outside of the compiler that is assembling piece-wise artifacts that can then be linked to calling code.

Interesting stuff.

that would be great