← Back to context

Comment by grayhatter

8 days ago

Alternative title; instead of learning a new language, I adapted it into something I'm more familiar with.

Depending on your language preference; Zig has issues[citation needed], but 1) it's still version 0 and 2) and this is the important part: who cares?

I get you have a pattern and shape you like a lot. But there's less value in that existing shape, than there is in being mildly uncomfortable, and expanding your world view and trying things in ways you wouldn't normally do.

If you tried it and didn't like it, cool, go back to the language you're already used to. But for everyone else. I'd encourage you to try doing things "wrong" for a while and seeing if you can't learn something from forcing yourself to do so.

Something especially true for a language that HN likes to pretend is just a toy and can't compete with [ language you already decided won ]

This is just a "complex real world app code" extension of the stdlib Diagnostics pattern.

  % rg Diagnostics zig/lib/std | wc -l
  165

The zig stdlib kind of has it easy because, for example, the json module can have one schema for error diagnostics. An app that stitches together a bunch of libraries and has a few internal modules is going to want some different Diagnostics schemas for different errors, and sharing those schemas and bubbling them up, so that's just what this is.