DIP 50 - AST macros

bearophile bearophileHUGS at lycos.com
Mon Nov 11 01:02:00 PST 2013


Jacob Carlborg:

> One of my favorite examples is the database query:
>
> auto person = Person.where(e => e.name == "John");
>
> Which translates to the following SQL:
>
> select * from person where name = 'John'

Can't you do the same thing with functions similar (same API but 
different semantics) to std.algorithm ones that generate 
expression templates?

auto person = persons.filter!(e => e.name == "John");

--------

simendsjo:

> * Number intervals, like "int i = int[10..20];" where only 10 
> to 20 are legal values

What's wrong with this syntax that doesn't reqiire macros? It's 
more uniform with the rest of the language:

Ranged!(int, 10, 20) i;

Bye,
bearophile


More information about the Digitalmars-d mailing list