Chances of D getting proper runtime reflection?

Jacob Carlborg doob at me.com
Sun Aug 21 08:05:20 PDT 2011


On 2011-08-21 15:13, Vladimir Panteleev wrote:
> On Sun, 21 Aug 2011 15:16:11 +0300, Jacob Carlborg <doob at me.com> wrote:
>
>> Yes, I know. But the point is to be able to do it without the use of
>> mixins. It needs to work with third party types, otherwise there no
>> use. It also needs to work when the static type is Object.
>>
>> You're already paying for the class info, which already contains
>> getMembers. But this methods always returns an empty array and as far
>> as I can see, it's not possible to set/get fields or call methods via
>> these member instances.
>
> I think the best way to do this is to improve compile-time reflection to
> the point where it'd be possible to enumerate all declarations in a
> module and create run-time reflection information for them - then you'd
> just need to specify the modules for which you'd like run-time
> reflection. One thing to note is that there are use cases where more
> run-time information about a program's internals may not be desired,
> e.g. with commercial closed-source applications, so this would need to
> be optional.

This is for a serialization library where third party types need to be 
serializable. I don't like the idea of annotate everything that should 
be serializable.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list