DIP 50 - AST macros

luka8088 luka8088 at owave.net
Wed Nov 13 06:47:27 PST 2013


On 13.11.2013. 13:26, Jacob Carlborg wrote:
> On 2013-11-13 09:34, luka8088 wrote:
> 
>> What about something like this?
>>
>> class Person {
>>
>>    macro where (Context context, Statement statement) {
>>      // ...
>>    }
>>
>> }
>>
>> auto foo = "John";
>> auto result = Person.where(e => e.name == foo);
>>
>> // is replaced by
>> auto foo = "John";
>> auto result = Person.query("select * from person where person.name = " ~
>> sqlQuote(foo) ~ ";");
> 
> That's basically what would happen.
> 

May/Should I add such example to wiki?

--
Luka


More information about the Digitalmars-d mailing list