3 ms·
Props to D for having such a simple implementation of fexprs[1]. The downside compared to macros I think is that, as argument expressions become lambdas, it be
by carlosneves 2mo ago
Props to D for having such a simple implementation of fexprs[1].
The downside compared to macros I think is that, as argument expressions become lambdas, it becomes harder to manipulate them. Check the cond example which needs two fexprs, whereas one macro could do it.
Not sure about D, but if it were lisp, even lambdas could be manipulated as lists. Macro args not having the lambda wrapping just seems simpler.
[1] https://en.wikipedia.org/wiki/Fexpr https://en.wikipedia.org/wiki/Fexpr
- brabel 2mo agoWalter Bright is against adding macros to D but D already has really advanced metaprogramming in other shapes: https://dlang.org/spec/template-mixin.html https://dlang.org/spec/template-mixin.html https://dlang.org/spec/traits.html https://dlang.org/spec/traits.html