DMD 1.005 release
Bill Baxter
dnewsgroup at billbaxter.com
Tue Feb 6 06:59:31 PST 2007
Walter Bright wrote:
> Kevin Bealer wrote:
>> You fixed all the bugs I've added in recent memory. Plus, if I
>> understand correctly, the implications of some of these features is
>> staggering...
>>
>> It looks like one could write a few hundred line module that can pull
>> in and do compile-time interpreting of a language of the complexity of
>> say, Scheme. And the code in the module could be both readable and
>> straightforward... And the results would be absorbed into the calling
>> code as normal optimizable statements...
>
> The irony is that it only took 3 hours to implement, which shows the
> power of having the lexing, parsing, and semantic passes be logically
> distinct.
>
> The idea is to enable the creation of DSLs (Domain Specific Languages)
> that don't have the crippling problem C++ expression templates have -
> that of being stuck with C++ operators and precedence.
>
> To make this work, however, one must be able to manipulate strings at
> compile time. I've made a start on a library to do this,
> std.metastrings, based on earlier work by Don Clugston and Eric Anderton.
>
> This is just the start of what's going to happen with D 2.0.
For those who haven't seen it, Walter updated
http://www.digitalmars.com/d/mixin.html with a simple example of what
you can do with the mixin string mojo.
Phobos also has new documentation for metastrings:
http://www.digitalmars.com/d/phobos/std_metastrings.html
It looks like this feature is calling out for some sort of new 'here
document' syntax, so that the code in strings can look and read more
like code.
It certainly seems to solve the long standing 'can't generate
identifiers at compile time' feature request. And then some. :-)
It'll be very exciting to see what people come up with!
--bb
More information about the Digitalmars-d-announce
mailing list