Proposal: Database Engine for D

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Fri Jan 1 03:03:12 PST 2016


On Friday, 1 January 2016 at 10:40:59 UTC, Kapps wrote:

> Someone else can explain better / more correctly than me, but I 
> believe the issue lies with opCmp and opEquals. You can make 
> expressions like p.Name.equals("James") work (I believe using 
> opDispatch), but because all you have is opEquals, you can't 
> know if the user put in 'p.Name == "James"` or `p.Name != 
> "James"`, as they both simply call opEquals. In order to do 
> that, you would need things like opLessThan, opEquals, 
> opNotEquals, opGreaterThan, etc, which would (with improper use 
> or bugs) cause other issues, like a < b && a > b and a == b && 
> a != b to be true, or a == b || a != b to be false.
>
> I'm also not certain how you could implement `p => p.Name == 
> "James" || p.Name == "Bob"`, but there might be a way? I think 
> this is the gist of it, but I'm likely wrong on some aspects of 
> this, so it would be good if someone else clarified..

That's exactly the problem. See an issue reported [1] and a 
related thread [2]. AST macros could solve the problem as well 
[3] (and many other problems).

[1] https://issues.dlang.org/show_bug.cgi?id=14593
[2] http://forum.dlang.org/thread/msvapl$2rmn$1@digitalmars.com
[3] http://wiki.dlang.org/DIP50

--
/Jacob Carlborg


More information about the Digitalmars-d mailing list