DIP 50 - AST macros

Timon Gehr timon.gehr at gmx.ch
Mon Nov 18 01:12:18 PST 2013


On 11/18/2013 09:22 AM, Jacob Carlborg wrote:
> On 2013-11-17 21:52, Walter Bright wrote:
>
>> 1. I don't believe we can decide on language features by analogy. D is
>> complex enough that one can use analogy to justify anything.
>>
>> 2. You cannot do anything behind a function call - the 'return'
>> discussed earlier, and async/await for another, i.e. operator
>> overloading cannot introduce control flow, cannot introduce variables
>> into the current scope, etc.
>
> You can turn this:
>
> BigInt(3) + 7;
>
> Into something that is not 10.
>
> You cannot do anything behind a macro. You cannot introduce new syntax.
>

Well, you could do:

@screwUp int foo(){ return 3+7; }

assert(foo()!=10);


More information about the Digitalmars-d mailing list