💾 Archived View for thebird.nl › blog › 2023 › zig.gmi captured on 2023-06-14 at 13:58:08. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-03-20)
-=-=-=-=-=-=-
Lately I have been writing zig code. A programming language that fits in my head and is super fast - what is not to like! Just ran into this article:
The code I wrote in Zig is a library that handles some VCF data - mostly to compute genotypes from merged records. vcflib, the caller, is mostly linear C++, and not excitingly fast. As a thought experiment I am wondering how zig will do as a DSL for VCF.
Years ago I wrote one in Ruby:
It is pretty fast - mostly because it leverages multiprocessing (Ruby itself is admittedly not very fast as a cost of dynamism).
The tool makes for a nice dynamic DSL though, as you can see from the examples in the README. bio-vcf is an under-utilised tool, in my opinion.
Anyway, working with a strictly typed language to create a fast DSL will be a challenge.
To write a useful library in Zig we would want:
And in a modern language you'd like something like
Deceptively simple threadpool example
Finally, because I like working against a REPL, it should be possible to use the code from, say, Guile. That means that low level primitives should have a mapping to/from Guile data elements.