Is D actually |-----------this-----powerful-----------|?

David Piepgrass qwertie256 at gmail.com
Sat Jun 9 09:29:42 PDT 2012


I do believe D is my new favorite language. I'm trying to figure 
out just how far you can take D... here's my question from 
StackOverflow:

http://stackoverflow.com/questions/10962541/is-d-powerful-enough-for-these-features

"For the longest time I wanted to design a programming language 
that married extensibility with efficiency. I recently 
rediscovered D and I am wondering if D 2.0 is pretty much the 
language I wanted to make myself. What I love most is the 
potential of metaprogramming; in theory, could D's traits system 
enable the following features at compile time?"

"1. Run-time reflection: Are the compile-time reflection features 
sufficient to build a run-time reflection system a la Java/.NET?"

"2. Code conversion: Using a metaprogram, create C#/C++/etc. 
versions of your D program every time you compile it (bonus point 
if doc comments can be propagated)."

"3. Traits. I don't mean the metaprogramming traits built into D, 
I mean object-oriented traits for class composition. A D program 
would indicate a set of traits to compose, and a metaprogram 
would compose them."

"4. Unit inference engine: Given some notation for optionally 
indicating units, e.g. unit(value), could a D metaprogram examine 
the following code, infer the correct units, and issue an error 
message on the last line? (I wrote such a thing for boo so I can 
assure you this is possible in general, program-wide):"


More information about the Digitalmars-d-learn mailing list