DMD 1.005 release

Yauheni Akhotnikau eao197 at intervale.ru
Thu Feb 8 01:00:48 PST 2007


>>  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.

Yes, but here we have two alternative approaches:

1) generation of strings with D code without access to addition  
information (my sample above). This is approach largely used in Ruby  
metaprogramming. And this is very useful approach in many situations, i.e.  
it is not an ideal solution, but useful (in my expirience);

2) manipulation of syntax tree in compilation phase, where the macros code  
has access to all information about programm's symbols (identifiers, types  
and so on). This approach is used in Nemerle, but there macroses received  
as input not string, but ordinal Nemerle code.

So my problem with understanding role of new D constructs (mixin  
expressions and import expressions) is: if the Ruby's approach with string  
generation is not appropriate then how to get something like Nemerle's  
approach if we use strings in mixin expressions?

-- 
Regards,
Yauheni Akhotnikau



More information about the Digitalmars-d-announce mailing list