4 ms·
The free online book nimprogrammingbook.com has chapters on templates [1] and macros [2] which explain them with nice examples. From what I gather from the D d
by lf-non 3y ago
The free online book nimprogrammingbook.com has chapters on templates [1] and macros [2] which explain them with nice examples.
From what I gather from the D docs (which I have only casually browsed through), the kind of adhoc ast construction that nim macros enable is not possible in D.
[1] https://www.nimprogrammingbook.com/book/nimprogramming_rouge_molokai.html#_templates https://www.nimprogrammingbook.com/book/nimprogramming_rouge...
[2] https://www.nimprogrammingbook.com/book/nimprogramming_rouge_molokai.html#_macros_and_meta_programming https://www.nimprogrammingbook.com/book/nimprogramming_rouge...
- WalterBright 3y agoD does not support macros quite deliberately, because macros make for incomprehensible code.