zlacker

[parent] [thread] 2 comments
1. kragen+(OP)[view] [source] 2025-08-25 03:41:04
A code generator is just a compiler; general arguments against code generation work equally well as arguments against using a compiler.

Writing a compiler is not "worse is better" and does not force you to hack something [fragile] together. Therefore, your argument is wrong.

replies(1): >>bccdee+aC4
2. bccdee+aC4[view] [source] 2025-08-26 15:12:33
>>kragen+(OP)
Empirically, I think you'll find that Go code generators are bad compilers. Go codegen isn't written with AST transformations and quasi-quote libraries. A macro system would be an opportunity for the Go compiler to take responsibility for the the tooling around metaprogramming; in the absence of that, we have a fragmented ecosystem where everyone is always reinventing a minimal, hacked-together version of the wheel so that they can get on with building the thing they actually need.

Frankly, an official Go codegen library would solve pretty much all my complaints, but the only difference between that and a macro system is compiler integration.

replies(1): >>kragen+pj6
◧◩
3. kragen+pj6[view] [source] [discussion] 2025-08-27 01:02:48
>>bccdee+aC4
Well, I do agree that bad compilers are bad, but I don't agree that a good compiler is basically a bunch of macros, or that emitting the code from the compiler backend with print statements correlates with a compiler being bad.
[go to top]