DIP 50 - AST macros

Walter Bright newshound2 at digitalmars.com
Tue Nov 12 15:26:36 PST 2013


On 11/12/2013 3:06 AM, Don wrote:
> On Tuesday, 12 November 2013 at 09:55:20 UTC, Walter Bright wrote:
>> I forgot to mention that "expression templates" can be used in D in an
>> equivalent manner that they are used in C++,
>
> They are crippled compared to C++, because you have no control over the return
> type of opCmp and opEquals, which means that you can't have expression templates
> involving comparisons. That's extremely limiting.

It is limiting, but I don't know about extremely limiting. Eric Anderton's regex 
engine didn't need them. And, if you really do need them, you can always define 
the templates as regular names:

    lessThan(a,b)
    equals(a,b)

etc. Not the greatest, but not unworkable.



More information about the Digitalmars-d mailing list