DMD 1.005 release

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


Pragma wrote:
> BLS wrote:
>> Pragma schrieb:
>>> 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.
>>>
>>
>> Hi Eric,
>> I am able to read and understand the code. (not nessesarily the far 
>> reaching implications)
>> But the generated code is still D. So what does it mean :
>> Walter Bright schrieb:
>>  > The idea is to enable the creation of DSLs (Domain Specific Languages)
>> How ?
>> Bjoern
> 
> 
> I think you answered your own question. :)
> 
> Take the compile-time regexp lib that Don and I wrote a while back.  
> Technically, Regular-expressions are a DSL of sorts.  This feature just 
> makes the implementation of stuff like that easier.  The end result will 
> still be D code.
> 
> auto widget = CreateNewWidget!("Some DSL Code");

You just showed something that I've been pondering attempting with this.  Namely a GUI 
library that builds all forms/controls/etc from some sort of markup (probably modified XML 
or JSON), either at runtime /or/ compile-time.

-- Chris Nicholson-Sauls



More information about the Digitalmars-d-announce mailing list