Time for std.reflection

Philippe Sigaud philippe.sigaud at gmail.com
Mon Jul 23 06:16:10 PDT 2012


On Mon, Jul 23, 2012 at 2:43 PM, David Nadlinger <see at klickverbot.at> wrote:
[getting subclasses]
> You can't do that without breaking the module system – as long as a class is
> not final (and then it doesn't make much sense to ask for its subclasses
> anyway), somebody can always extend it in a module completely separate from
> the code making the query.
>
> To illustrate what I mean, let's assume you define a class Foo in a module
> A. The user imports A from a second module B, and potentially extends Foo
> there. Now, if it was possible to get all possible subclasses in A, this
> would lead to information leaking from B to A, while the import graph only
> allows the other direction. As a consequence, all kinds of issues related to
> order dependence, separate compilation, etc. would arise.

Yes, I know. That would be a purely local question: from module A,
what subclasses of class Foo do I see?
Anyway, maybe I'm warped by CLOS.


More information about the Digitalmars-d mailing list