DIP 50 - AST macros

Don x at nospam.com
Wed Nov 13 01:08:24 PST 2013


On Wednesday, 13 November 2013 at 08:45:13 UTC, Walter Bright 
wrote:
> On 11/13/2013 12:03 AM, Jacob Carlborg wrote:
>> Again, operator overloading in D is too limiting to implement 
>> something Linq like.
>
> Ok, let's set aside the opEquals and opCmp issue for the moment.
>
> Can AST macros do anything that expression templates cannot?

With an expression template you still can't create a statement. 
It has to revolve to a declaration.

But as I said before, it's primarily syntax sugar. Expression 
templates are just a mass of boilerplate code. I came to the 
conclusion that the code for expression templates was no less 
ugly than for string mixins.

What is true, though, is everything an AST macro can do, can 
already be done with a string mixin. The syntax is just ugly.

                  calling syntax power  implementation
string mixin       ugly         high      ugly
expr template       ok          low       ugly
AST macro          good          ?         ?




More information about the Digitalmars-d mailing list