Runtime introspection, or how to get class members at runtime Fin D

Arafel er.krali at gmail.com
Fri Jun 8 08:06:27 UTC 2018


On Thursday, 7 June 2018 at 13:07:21 UTC, evilrat wrote:
>
> I don't think so. It clearly states that children must mixin 
> too, which can mean it just grabs symbols in scope only, and 
> base class has no way of knowing about its subclasses. It also 
> has "agressive mode" that will make metadata for all public 
> symbols(?) it can walk, this may or may not be helpful 
> depending on your requirements.
>

Yes, that's what I understood from looking at it, but perhaps I 
was just missing something. I wonder though how the "agressive 
mode" would work with separate compilation / dlopen'ed libraries. 
Perhaps I should give it a try and see what happens.

> Besides there is no way(not that I am aware of) to make self 
> registering stuff happen, you still need to call it somewhere. 
> The most transparent option is probably just doing a mixin in 
> each module that performs registration of all module symbols in 
> module ctor.
> The point is that there is absolute requirement to make 
> explicit call for that, be it a module ctor mixin, class mixin 
> or even user provided registration both at compile time or run 
> time.
> But since it is MIT licensed you can probably use the code as 
> the starting point and adjust to your own needs.
>
>
>
> BTW plug-ins is something that is right now possible on 
> Linux(not sure about support on other *NIX systems), but in a 
> very primitive form on Windows.
> This is related to DLL support issues(such as type information 
> not being passed across process/DLL boundaries), these issues 
> also may include runtime issues as well such as inability to 
> delegate the GC, which will mean there will be 2(or more) 
> concurrent running GC's. But again I am not aware of the 
> current situation.

Well, I'm already tightly coupled to linux, so this is not a big 
concern for me :-)

I'll keep trying, as I said, my intention was to let plugin 
writers do it as easily as possible, but well, adding some kind 
of "register" function might be necessary in the end...

A.



More information about the Digitalmars-d-learn mailing list