Meta-Programming

David B. Held dheld at codelogicconsulting.com
Fri May 25 09:09:19 PDT 2007


Mahe wrote:
> I have worked with D for some months. It is much better than C++ and a good alternative to Java or C#.
> 
> But I think a really powerful aspect is missing in D compared to Java/C#: Meta-Programming!
> In D it is only possible to create a class with a standard constructor from a string with a class name in it. But there is no introspection of the structure of the class, no dynamic method calls, no dynamic attribute reading or setting.
> But such reflection possibilities are important in component based software design of large systems.   
> [...]

This is usually called "reflection", since it doesn't really imply code 
generation the way templates and macros does.  D does provide reflection 
through type tuples and class constructors, but it could use some better 
support.  As for actual metaprogramming support, D blows Java/C#/C++ out 
of the water.

Dave



More information about the Digitalmars-d mailing list