Chances of D getting proper runtime reflection?

Alex Rønne Petersen xtzgzorex at gmail.com
Sun Aug 21 06:31:14 PDT 2011


On 21-08-2011 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.
>

I really don't think this is a valid cause of concern in this day and 
age. Look at Java and .NET. They're doing just fine even with all 
metadata being available. Plenty of commercial C++ products ship with 
RTTI these days, too (AAA games, even).

What I mean to say is, I don't think we should let this "concern" hamper 
runtime reflection in D, because it evidently is not as big of an issue 
as people have made it out to be in the past. Security through obscurity 
is bad, as the saying goes.

Regards,
Alex


More information about the Digitalmars-d mailing list