DIP 50 - AST macros

Jacob Carlborg doob at me.com
Mon Nov 11 01:35:20 PST 2013


On 2013-11-11 10:23, simendsjo wrote:
> On Monday, 11 November 2013 at 09:02:01 UTC, bearophile wrote:

>> auto person = persons.filter!(e => e.name == "John");
>
> The problem here is that a library need to know that it has to create
>    SELECT * FROM persons WHERE name = 'John';
> and not
>    SELECT * FROM persons;
> and filter it locally.
> So it needs a way to inspect the body of the delegate and extract "name"
> "==" and "John".

This particular example would work. "e" would be a proxy which 
implements opDispatch which returns another proxy which overloads 
opEquals. The problem is that != and all the comparison operators won't 
work. See my reply to bearophile:

http://forum.dlang.org/thread/l5otb1$1dhi$1@digitalmars.com?page=3#post-l5q892:242kpf:241:40digitalmars.com

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list