Functional Programmers need to take a look at Zig
Key takeaways
- I ve been tinkering around with Zig to explore what s possible with comptime.
- Second, I am desperately trying to avoid writing a functional systems language.
- So how does this connect with systems programming?
I ve been tinkering around with Zig to explore what s possible with comptime. Whenever I evaluate a new language I use three axes:
Enter Zig. I m interested in Zig for a few reasons. First, I suspect that comptime is a simpler and more flexible system to achieve a lot of the type-system programming I ve seen in the Haskell-verse and I ve done enough Haskell (over 10 years) that programming the type system is now a hard requirement for me to take any language seriously.
Second, I am desperately trying to avoid writing a functional systems language. This is probably a blog post in its own right but the programming language industry has not grokked the meaning of monads. Monads are not some kind of obscure math-y thing that only the big brains think are necessary. No, instead monads are a fundamental abstract algebraic description of imperative programming as a computational context. They allow a programming language to not have a built-in notion of time (among other things). So if I want an imperative programming language I can implement MonadCont (the continuation monad), if I want a logic programming language I can implement LogicT (a monad that has non-deterministic semantics and backtracking). Not having a built-in notion of time means that my language is de-facto more expressive, allows users to mold the language to their needs, and improves the optimization ceiling compilers for that language can achieve.