Chances of D getting proper runtime reflection?

Jacob Carlborg doob at me.com
Mon Aug 22 23:30:14 PDT 2011


On 2011-08-22 22:26, Andrei Alexandrescu wrote:
>
> Yes. Better yet:
>
> class Derived : Base
> {
> ...
> }
>
> mixin(serializable!Derived());
>
> i.e. so you can add serialization to classes you can't edit.

Yeah, of course. So "The line of code needs to be declarative,
not imperative" was just a fancy way of saying that you want to move the 
class registration to global scope :)

>> The only way I can think of how this could work is to store a global
>> list of the serializable classes. Any other suggestion how this would
>> work? Note that all this wouldn't be necessary if my original post was
>> implemented.
>
> A global structure sounds the way to go.
>
>
> Andrei

Ok, then I just change "register" to a static method.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list