DMD 1.005 release

Chris Nicholson-Sauls ibisbasenji at gmail.com
Tue Feb 6 13:03:01 PST 2007


Pragma wrote:
> BLS wrote:
>> I guess here is a need for further explaination.
>>
>> Either I am an complete idiot (not completely unrealistic) and 
>> missunderstood something, or a new, quit radical, programming 
>> paradigmn change is on it s way.  I mean it is difficult to realize 
>> the implications.
>> Bjoern
> 
> Just try to wrap your head around this: 
> http://www.digitalmars.com/d/mixin.html
> 
> template GenStruct(char[] Name, char[] M1)
> {
>     const char[] GenStruct = "struct " ~ Name ~ "{ int " ~ M1 ~ "; }";
> }
> 
> mixin(GenStruct!("Foo", "bar"));
> 
> //which generates:
> 
> struct Foo { int bar; }
> 
> In short this means that we can have *100%* arbitrary code generation at 
> compile time, w/o need of a new grammar to support the capability.
> 

Combine that with the ever increasing power of Tuples, some of the slowly improving type 
info, and compile-time string manipulation.... and you've got programs that write programs 
for writing programs that generate the original program automatically.  o_O

I like it.  Might even scrap some old code in favor of it.

-- Chris Nicholson-Sauls



More information about the Digitalmars-d-announce mailing list