DIP 50 - AST macros
Dicebot
public at dicebot.lv
Tue Nov 19 05:16:42 PST 2013
On Tuesday, 19 November 2013 at 07:23:52 UTC, Jacob Carlborg
wrote:
> Well, it depends on how you look at it. You don't need to
> modify the lambda, but you're changing the meaning of it.
Not really. You won't say that this snippet changes the meaning
of lambda, do you?
```
foo(a => a*2);
// ...
bool foo(T)(T func)
{
// does not even call `func` and does something unrelated
return is(ReturnType!T == int);
}
```
This is pretty much the same. Functions and templates can do
arbitrary things unrelated to their input and we do not call it
"changing the meaning" of the input. Macros are not much
different here. Though I'd still prefer requirement for explicit
"macro!" syntax or something similar, just to make clear that
code gen is incoming.
More information about the Digitalmars-d
mailing list