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

2018-06-13 Thread concepthf via Digitalmars-d-learn
On Friday, 8 June 2018 at 08:21:39 UTC, evilrat wrote: On Friday, 8 June 2018 at 08:06:27 UTC, Arafel wrote: 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

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

2018-06-08 Thread evilrat via Digitalmars-d-learn
On Friday, 8 June 2018 at 08:06:27 UTC, Arafel wrote: 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

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

2018-06-08 Thread Arafel via Digitalmars-d-learn
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

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

2018-06-07 Thread evilrat via Digitalmars-d-learn
On Thursday, 7 June 2018 at 12:32:26 UTC, Arafel wrote: Thanks for all the answers! Is it possible to register, say, a base class, and have all the subclasses then registered automatically? My idea would be to make it as transparent as possible for the plugin implementation, and also not

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

2018-06-07 Thread Arafel via Digitalmars-d-learn
Thanks for all the answers! Is it possible to register, say, a base class, and have all the subclasses then registered automatically? My idea would be to make it as transparent as possible for the plugin implementation, and also not having to depend on it. A. There is a library that

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

2018-06-07 Thread evilrat via Digitalmars-d-learn
On Wednesday, 6 June 2018 at 13:28:02 UTC, Arafel wrote: I know it might not be the most idiomatic D, but as somebody with mostly a Java background (with some C and just a bit of C++) it seems something really straightforward to me: myObject.getClass().getFields() [2]. Also, I know I could

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

2018-06-06 Thread Jacob Carlborg via Digitalmars-d-learn
On 2018-06-06 15:28, Arafel wrote: Hi, What is the state of runtime introspection in D, specifically for classes? Is there any way to get *at runtime* the (public or otherwise accessible) members of a class? I have had a look as TypeInfo_Class [1], but apparently I can only get a list of

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

2018-06-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/6/18 9:28 AM, Arafel wrote: Hi, What is the state of runtime introspection in D, specifically for classes? Is there any way to get *at runtime* the (public or otherwise accessible) members of a class? There is very little runtime reflection capability. The position has always been

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

2018-06-06 Thread Arafel via Digitalmars-d-learn
On 06/06/2018 03:52 PM, Adam D. Ruppe wrote: It is possible to add it to the runtime library right now (there's a thing called rtInfo in there made to hold it, it is just null right now), just people fight over even a few bytes of added metadata. So if it is added, it would surely be some

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

2018-06-06 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 6 June 2018 at 13:44:39 UTC, Arafel wrote: Why not (genuine question)? There's even myObject.classinfo, and I can only assume that there's some reason why it's there... It holds just barely enough info for dynamic casting, GC, and other language implementation stuff. (and then

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

2018-06-06 Thread rikki cattermole via Digitalmars-d-learn
On 07/06/2018 1:44 AM, Arafel wrote: On 06/06/2018 03:30 PM, rikki cattermole wrote: You don't want TypeInfo. Why not (genuine question)? There's even myObject.classinfo, and I can only assume that there's some reason why it's there... In this case, what I'm trying to do is to serialize

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

2018-06-06 Thread Arafel via Digitalmars-d-learn
On 06/06/2018 03:30 PM, rikki cattermole wrote: You don't want TypeInfo. Why not (genuine question)? There's even myObject.classinfo, and I can only assume that there's some reason why it's there... In this case, what I'm trying to do is to serialize / dump / print the contents of an

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

2018-06-06 Thread rikki cattermole via Digitalmars-d-learn
On 07/06/2018 1:28 AM, Arafel wrote: Hi, What is the state of runtime introspection in D, specifically for classes? Is there any way to get *at runtime* the (public or otherwise accessible) members of a class? No. I have had a look as TypeInfo_Class [1], but apparently I can only get a

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

2018-06-06 Thread Arafel via Digitalmars-d-learn
Hi, What is the state of runtime introspection in D, specifically for classes? Is there any way to get *at runtime* the (public or otherwise accessible) members of a class? I have had a look as TypeInfo_Class [1], but apparently I can only get a list of types and offsets... which would be