Abstract Database Interface

Kapps opantm2+spam at gmail.com
Tue Oct 30 05:04:53 PDT 2012


On Tuesday, 30 October 2012 at 10:01:06 UTC, Philippe Sigaud 
wrote:
> On Tue, Oct 30, 2012 at 9:15 AM, Jacob Carlborg <doob at me.com> 
> wrote:
>> On 2012-10-30 04:22, BLM768 wrote:
>>
>>> If you make x some fancy wrapper type containing more fancy 
>>> wrapper
>>> types with overloaded equality operators that return some 
>>> sort of
>>> Expression class instead of a boolean, you might actually be 
>>> able to get
>>> this to work with only D's current features. However, that 
>>> would kind of
>>> destroy the hope of efficiency. :)
>>
>>
>> It can probably all be handled at compile time. The problem 
>> with this that
>> you cannot overload the following operators: &&, ||, != and 
>> probably some
>> other useful operators.
>
> && and || can be replaced by & and |, so there is a workaround.
> I feel much more limited by != and, even more problematic, !.  
> Maybe
> unary - could be used in lieu of !.

There was a pull request for __traits(codeof, func) that would 
return the code for a symbol including lambda methods. It would 
probably be easier to have something like that for getting the 
AST and then using that to generate SQL queires (this is how C# / 
LINQ does it) than using sketchy hacks that go against natural 
language feel. Though it wouldn't be particularly easy to get 
that in to the compiler apparently due to AST rewriting issues.

https://github.com/D-Programming-Language/dmd/pull/953



More information about the Digitalmars-d-announce mailing list