Chances of D getting proper runtime reflection?

Jacob Carlborg doob at me.com
Sun Aug 21 05:11:37 PDT 2011


On 2011-08-21 13:41, bearophile wrote:
> Jacob Carlborg:
>
>> class Foo
>> {
>>       private int a;
>>
>>       private void bar (int i)
>>       {
>>           a = i;
>>       }
>> }
>>
>> auto foo = new Foo;
>> Object o = foo;
>> o.setInstanceVariable("a", 3);
>> assert(foo.a == 3);
>
> Is this related to the Delphi feature I've recently shown?
> http://blog.barrkel.com/2010/09/virtual-method-interception.html

I don't think so, but it might help.

> I presume you will have to write:
>
> @reflection class Foo
> {
>      private int a;
> ...
>
> To be sure to not pay for this dictionary when you don't need it. In theory this annotation is unnecessary.
>
> Bye,
> bearophile

That's not an option because it needs to work on third party types as 
well. BTW, you're already paying for the class info.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list