Operator overloading or alternatives to expression templates

Sönke Ludwig via Digitalmars-d digitalmars-d at puremagic.com
Sun Sep 13 02:00:32 PDT 2015


Am 11.09.2015 um 21:40 schrieb Martin Nowak:
> I find the reasons for turining down my ER a bit moot.
>
> [Issue 14593 – operator overloading can't be used with expression
> templates](https://issues.dlang.org/show_bug.cgi?id=14593)
>
> (...)

The missing support for overloading the individual relational operators 
is something that has often turned out very limiting to me in the past, 
too. The opCmp approach is good as a default, but explicitly disallowing 
implementation of the individual operators seems arbitrary.

> Now expression templates make an awful DSL when being used to create a
> HTML formatter, but when the original semantic of the operators is
> preserved they are really powerful b/c the compiler already handles
> typechecking, operator precedence, and captures variables.
>
> Does anyone have a different idea how to make a nice query language?
> db.get!Person.where!(p => p.age > 21 && p.name == "Peter")

I had played around with some ideas for a similar project, but didn't 
find a really satisfying solution:
https://github.com/rejectedsoftware/dotter/blob/11ec72325e76c3329a58545526940c1df5328a2d/source/dotter/orm.d#L320


More information about the Digitalmars-d mailing list