DIP 50 - AST macros

Rikki Cattermole alphaglosined at gmail.com
Tue Nov 12 18:48:56 PST 2013


On Tuesday, 12 November 2013 at 16:39:18 UTC, Andrei Alexandrescu 
wrote:
> On 11/12/13 7:21 AM, Ellery Newcomer wrote:
>> the .NET framework can do this because it exposes an api for 
>> querying,
>> building, and compiling asts.
>>
>> D cannot do this because it doesn't. (and I have tried to make 
>> it work)
>
> Maybe the problem needs to be reformulated for D. I think an 
> SQL mixin that either stays unchanged (for DB engines) or 
> translates to a D expression (for native D data types) would be 
> doable, nontrivial, interesting, and instantly usable for 
> people who already know SQL without any extra learning. In 
> other words... actually better than Linq.
>
> Andrei

I was using linq as an example of what we could do with this DIP 
or what it should be able to do. It wasn't a suggestion of how we 
should implement such a library.

I also identified with it that having scoped variables from the 
initiation call is required for safety as well as pragmas for 
error. Later Jacob alerted me to warning as well. Will submit 
pull once warning is done.

I also suggested a generic lexer with rules to make it well 
defined. With it also if's like templates have for macro over 
loading but nobody was keen for this hence not on wiki.

Yes this can be done already in theory however it doesnt make it 
not a valid use case.


More information about the Digitalmars-d mailing list