DIP 50 - AST macros

luka8088 luka8088 at owave.net
Fri Nov 22 01:27:19 PST 2013


On 21.11.2013. 9:31, Jacob Carlborg wrote:
> On 2013-11-21 09:01, luka8088 wrote:
> 
>> When using q{} compiler treats the contents as a regular string, and you
>> have to parse it and give it to the compiler using "mixin". So basically
>> you can say to the compiler: this part of code is my DSL and I will
>> parse it and check the semantics instead of you, then when I am done I
>> will give you D AST represantation of it.
>>
>> The interpretation of the content of q{} is up to you, where in other
>> proposals compiler builds AST based on, I would say, guessing.
>>
>> Take a look at this last example. And lets say that it is from python.
>> In python dont2() belong inside else block. So how else would you make
>> sure that compiler behaves accordingly?
> 
> Sorry, I meant your original suggestion of using t{}.
> 

Um, my it's suppose to be the same as <[ ... ]> but I liked t{ ... }
syntax better as it looked more consistent with what D already has. But
I should have used <[ ... ]> , my mistake sorry.



More information about the Digitalmars-d mailing list