DMD 1.005 release

Walter Bright newshound at digitalmars.com
Thu Feb 8 00:35:29 PST 2007


Yauheni Akhotnikau wrote:
> On Thu, 08 Feb 2007 10:06:04 +0300, Walter Bright 
> <newshound at digitalmars.com> wrote:
> 
>> Yauheni Akhotnikau wrote:
>>>> The main difficulty is if the DSL needs to access symbols in the 
>>>> rest of the D code.
>>>  I agree.
>>> But how do you think do such things in the current approach?
>>
>> int i = 4;
>> mixin("writefln(i)");
>>
>> will print:
>>
>> 4
> 
> I understand that :)
> But suppouse than string "writefln(i)" has been produced by some DSL 
> transformator:
> 
>  int i = 4;
>  mixin( ProduceWritefln("i") );
> 
> The content of ProduceWritefln() need no access to variable i -- it 
> makes some string which transformed to D code only in mixin(), not in 
> ProduceWritefln. So the main task of ProduceWritefln is manipulating of 
> string without access to any existed D code.
> 
> So my point is to allow to ProduceWritefln be ordinary D code which 
> executed at compilation time.

I see your point, but passing arguments "by name", which is what your 
example does, means the function has no access to whatever that name is 
- such as its type, size, etc.



More information about the Digitalmars-d-announce mailing list