DIP 50 - AST macros

Jacob Carlborg doob at me.com
Mon Nov 18 00:42:32 PST 2013


On 2013-11-17 22:15, Ellery Newcomer wrote:
> On 11/17/2013 11:41 AM, Simen Kjærås wrote:
>>
>> Source is attached. I hope God forgives me.
>>
>
> I suppose you'd have to do something like
>
> x.Where(OR( NOT(Args.thing = "thing"), Args.sing = "sing"))
>
> for nesting and negation and all that.
>
> I'd wait for walter to relax the restrictions on ==, &&, etc operator
> overloading. Then you probably could do
>
> x.Where(X => X.thing != "thing" || X.sing == "sing")
>
> let's see here. If X's type is QueryExp!Entity and the return type is
> SomeRange!Entity then querying looks doable.
>
> how about composing expressions? take the result of that lambda EXP,
> EXP = EXP && X.cling == 1; // should work fine?
>
> how about decomposing expressions?
> EXP = EXP.lhs; // should work fine?
>
> EXP.rhs.rhs.value // returns "sing" - should work fine? the lambda
> should create a closure, so we should be able to get out any value we
> put in
>
> you won't be able to do
>
> x.Where(X => upper(X.thing) == "THING")

That works with the Rails plugin Squeel. Although you need to prefix 
"upper" with "X.".

https://github.com/ernie/squeel

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list