News for hackers. Stuff that matters.
Re:Zig's Comptime Is Bonkers Good by benob on Tuesday January 07, 2025 @05:08AM (#42621044)
> How do you people debug and test these meta programs?

I couldn't find any other answer than using @compileLog to print-debug [1]. In lisp, apparently some implementations allow to trace macros [2]. Couln'd find anything about Nim's macro debugging capabilities.

This whole thing looks like a severe limitation that is not balanced by the benefit of having all code in the same place. Do you know other languages that provide sensible meta-programming facilities?

[1] https://www.reddit.com/r/Zig/comments/jkol30/is_there_a_way_... [2] https://stackoverflow.com/questions/44872280/macros-and-how-...

Re:Zig's Comptime Is Bonkers Good by disentanglement on Tuesday January 07, 2025 @12:11PM (#42624737)
In lisp, macros are just ordinary functions whose input and output is an AST. So you can debug them as you would any other function, by tracing, print debugging, unit tests or even stepping through them in a debugger.