4 ms·
> The best solution I have found, disregarding of language, is to use the same language to write a program that generates the code you need. Sounds like a pitc
by saghm 4y ago
> The best solution I have found, disregarding of language, is to use the same language to write a program that generates the code you need.
Sounds like a pitch for lisp; I haven't really used any lisp variant much, but I always hear about people saying they basically write a program to generate their program rather than actually just solving the problem directly.
- LanternLight83 4y agoAbsolutely; Complex macros are frequently written by breaking them up into smaller "actual" functions. The body of the macro just receives it's unevaluated arguments and calls those functions on them, because the only thing that's special about it is when it runs, that it's arguments are initially unevaluated, and that it's output is interpreted (possibly by a compiler) as code. Within the context of the macro's body, it's lisp like any other.
- kaba0 4y agoOr zig’s compile time functions.