DMD 1.005 release
Yauheni Akhotnikau
eao197 at intervale.ru
Wed Feb 7 23:01:49 PST 2007
> I agree with the point that metaprogramming needs more control
> structures.
>
> static for, static foreach, static while, static do, static switch case,
> etc.
I think it is not a good way. Because this leads to two different
languages in one: compile-time D (constructs from ordinal D but with
prefix 'static') and run-time (ordinal D).
If it is necessary to use compile-time D then the following difficalties
arose:
* it is imposible to use externals tools, such as compiler-compiler
generators, which produces ordinal D code;
* it is hard to debug compile-time code -- how to launch debugger at
compile time?
* it is necessary to construct compile-time unit tests;
* it is impossible to use existing D libraries for DSL transformations.
I'm use Ruby a lot and much metaprogramming things done via creating
strings with Ruby code and evaluating it by various 'eval' methods. It is
very simple method -- easy in writting, debugging and testing. And there
isn't two different Ruby -- only one language.
Yet another example -- Nemerle (http://www.nemerle.org). But Nemerle use
different technique -- code of macros have access to syntax tree at
compilation stage.
--
Regards,
Yauheni Akhotnikau
More information about the Digitalmars-d-announce
mailing list