DIP 50 - AST macros

Walter Bright newshound2 at digitalmars.com
Wed Nov 13 16:16:48 PST 2013


On 11/13/2013 3:58 PM, deadalnix wrote:
> On Wednesday, 13 November 2013 at 22:34:02 UTC, Walter Bright wrote:
>> On 11/13/2013 2:18 PM, deadalnix wrote:
>>> Was is missing is the capability to look into the lazy parameter's ast and act
>>> accordingly.
>>>
>>> Here you can wrap something around code, not generation code depending on passed
>>> code.
>>
>> That's correct. But you can look into the AST with expression templates. So,
>> expression templates combined with lazy arguments and mixin templates may fill
>> the problem space.
>
> Expression templates are limited to expression and require to use its own set of
> types.

Yes. But that's a good thing. I'd be pretty skeptical of the value of an AST 
macro that took 3+4 and changed it so it did something other than compute 7.


> Still the idea has some merits.

It has the merit of being implemented and available right now :-)

I do understand that expression templates aren't very sexy, and are kinda hard 
to wrap one's head around. But they're not so bad from the perspective of the 
user of the expression templates, and I really think that the limits of existing 
features should be explored before inventing wholesale new ones that may turn 
out to be redundant.



More information about the Digitalmars-d mailing list