Meta(
    title: "C: because danger is fun",
    summary: Some("I have been working on a project concurrently in several languages, including C, and am surprised at how much I'm enjoying the experience"),
    published: None,
    tags: [
        "C",
        "programming",
    ],
)
---
If you've looked at my programming output at all it should be pretty obvious that I have bought into Rust. But truth be told, I never intended to go whole hog into any one programming language. I love fooling around in new languages and sometimes in older ones that are becoming more obscure (I'm looking at you, Fortran), but I've come to depend on Rust's ecosystem and some of it's builtin features when it comes time to get something done.

A while back I was working on a package manager for my little toy Linux distro, HitchHiker, and I decided to embed the ability to read and write Tar archives in it. The Tar capability had to be in the binary, because I wanted to be able to read a file into memory, checksum it, and create a tar node in one operation rather than reading it into memory twice, which I would have to do if Tar was external. In the process, I decided that I really don't care much for Tar and started thinking about what an archive format designed from scratch might look like, which fixed a lot of Tar's weaknesses. What I came up with is a format that I'm calling Haggis.

=> https://codeberg.org/jeang3nie/haggis/Format.md

Now, I'm not trying to replace Tar and don't recommend that people start using this. It's mostly a fun experiment at this stage, and I've been using it to re-evaluate programming languages in the process. I have simultaneous implementations in various degrees of completion in Rust, Zig, Hare and C. This post isn't even going to be about Haggis itself, or the different languages being used. It's going to be about how much fun I've been having revisiting C, which is totally surprising to me at this point considering how attached I've gotten to language features such as algabreic data types and Rust's great concurrency primitives.

## A Short aside on Zig
Zig is still pre-1.0. They released their self hosted compiler for version 0.10 and the upcoming 0.11 release is seeing some serious progress in implementing missing language features that have been accepted into the spec for the language. Things are progressing at a surprisingly fast pace considering how small their community is, but it's got a ways to go before it becomes a true competitor. That said, I feel that Zig's type system and safety checks get me about 90% of the benefits people ascribe to Rust without the overhead of a borrow checker. Manual memory management also has benefits in that you have flexibility to do things that Rust's borrow checker will never allow, and makes doing other things easy that the borrow checker makes into a nightmare of lifetime annotations and ridiculously complex type signatures. In short, when it matures I think Zig is going to absolutely rock the world.
