DIP 50 - AST macros

simendsjo simendsjo at gmail.com
Mon Nov 11 00:28:41 PST 2013


On Sunday, 10 November 2013 at 22:33:34 UTC, bearophile wrote:
> Jacob Carlborg:
>
>> http://wiki.dlang.org/DIP50
>
> I suggest to add some more use cases (possibly with their 
> implementation).
>
> Bye,
> bearophile

I agree examples would help a lot. Trying to define what 
information actually exists within these types would also help a 
lot.

In the first example, would Ast!(bool) be something like this?
   opBinary!"=="
     left = opBinary!"+"
              left = Literal
                type = int
                value = 1
              right = Literal
                type = int
                value = 2
     right = Literal
       type = int
       value = 4

Would there be helpers for matching part of the structure?
The same applies to the other types used - what information 
should they have?

As for examples, here's a couple of suggestions:
* Expression to prefix notation
* Expression to SQL
* AutoImplement properties (like C#)
* Number intervals, like "int i = int[10..20];" where only 10 to 
20 are legal values
* Discriminated union
* Pattern matching


More information about the Digitalmars-d mailing list