4 ms·
Which is why Zig's top feature on its webpage is "No hidden control flow."
by rootlocus 3mo ago
Which is why Zig's top feature on its webpage is "No hidden control flow."
- self_awareness 3mo agoIronically, the 'no hidden control flow' was one of the arguments against Zig in the recent Bun rewrite to Rust. https://bun.sh/blog/bun-in-rust https://bun.sh/blog/bun-in-rust So sometimes hidden control flow is needed.
- applfanboysbgon 3mo agoThat tells you more about the people writing Bun than it does Zig or what's "needed" for people actually writing and reading code. Bun dev is not just hiding the control flow, their goal is to hide all of the code so that no human reads it, ever.
- self_awareness 3mo agoI mean, there's an easier way of doing that than rewriting to another language, just make the repo private.
- lelanthran 3mo ago> Ironically, the 'no hidden control flow' was one of the arguments against Zig in the recent Bun rewrite to Rust. Yeah, but that makes sense: if you want "hidden everything", which they appear to want due to now having a code base that has never been read by a human, then a subset of "want everything hidden" is "want control flow hidden".
- himata4113 3mo agoHonestly I am pretty sure AI would be better at zig than rust since zig has no hidden control flow which means that AI has the full context of any given function without having to find traits. The rewrite to rust from bun is as much of as PR stunt as fustration with DX of zig. Every time I want to interact with zig code I just have the AI do it since I honestly can't be asked to change 3 lines and around 3 to 5 characters when it's a single keybind in every other language which in turn has lead me to experiment quite a lot 'writing' in zig. It's rather pleasant to look at, however, I wouldn't want to write code myself. Rust is by far the most enjoyable dx experience since everything usually 'just works' across machines and even architectures while having a strong sense of assurance that compiled applications will work as expected before ever running them once. node/bun/whatever is probably the worst here since compilation means nothing for runtime as undefined symbols will happily 'compile' (transpile?).
- chrisjj 3mo ago> Honestly I am pretty sure AI would be better at zig than rust since zig has no hidden control flow which means that AI has the full context of any given function without having to find traits. You say that as if having to find traits was a problem ... for a bot.
- himata4113 3mo agoTraits are harder to find since multiple traits can apply, but the one strictest one wins. They also have to be followed from generic types which adds a whole other layer of complexity, without an LSP it's a lost cause.
- chrisjj 3mo ago> Traits are harder to find Sure, but what matters is whether that's too hard for an "AI".
- himata4113 3mo ago1 read vs realizing that lsp exists and using it correctly, even if ai is smart that's more token burn and it is slower making zig 'better'. It also has to realize that "Drop" exists and know what it does since there's nothing in code that clearly says "this object is automatically dropped by the compiler on scope end.