On 11/13/2013 1:08 AM, Don wrote:
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.

Actually, there is a way to do this. I wrote an article years back on how to write "statement" workalikes using lazy function parameters. I suppose I should dig that up if I can find it.


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          ?         ?

This implies to me that we ought to explore the limits of expression templates, which already exist, in preference to creating a wholesale new feature.

Reply via email to