News for hackers. Stuff that matters.
Re:Zig's Comptime Is Bonkers Good by dboreham on Tuesday January 07, 2025 @08:42AM (#42622185)
But exactly why?
Re:Zig's Comptime Is Bonkers Good by jerf on Tuesday January 07, 2025 @09:26AM (#42622619)
If you just walked up to me out of the blue and asked "what computer language do you know is the worst for processing strings?", well, technically I might answer "assembler", but if you excluded that, my next answer would be C.

Furthermore, you want some sort of AST representation, at one level of convenience or another (I include this compgen-style "being 'in' the AST" to be included in that, even if it doesn't necessarily directly manipulate AST nodes), and C isn't particularly great at manipulating those, either, in a lot of different ways.

A consequence of C being the definitive language that pretty much every other language has had to react to, one way or another through however many layers of indirection, for the past 40+ years, is that pretty much every language created since then is better than C at these things. C's pretty long in the tooth now, even with the various polishings it has received over the years.

Re:Zig's Comptime Is Bonkers Good by 0x696C6961 on Tuesday January 07, 2025 @09:17AM (#42622517)
Because after enough hands have touched a codegen script, debugging it becomes impossible.
Re:Zig's Comptime Is Bonkers Good by 0x1ceb00da on Tuesday January 07, 2025 @11:34AM (#42624283)
In jai you use the same language for programming and metaprogramming. The compiler knows how to execute the bytecode it generates. The compiler also has a builtin debugger for the bytecode.