First Steps: Dynamic class instantiation
Benji Smith
dlanguage at benjismith.net
Sun Jan 28 11:04:55 PST 2007
Kirk McDonald wrote:
> This can't really be done in D, which is statically typed. Languages
> like PHP are dynamically typed. You'll have to do some re-thinking of
> your design, I think.
Well, Java is statically typed, and it can do what the OP requested.
It's not really a question of dynamic/static typing. It's more a
question of whether runtime reflection is supported. And right now, D's
runtime reflection capabilities aren't as complete as Java's.
Personally, I'm not crazy about reflection-heavy code, since I think it
provides a sneaky mechanism for subverting the compile-time
type-checking system. Debugging Java code that makes heavy use of
reflection is not a pleasant experience (since all of your exceptions
get swallowed up in the reflection API, as InvocationTargetExceptions).
--benji
More information about the Digitalmars-d
mailing list