Chances of D getting proper runtime reflection?
Jacob Carlborg
doob at me.com
Tue Aug 23 00:55:50 PDT 2011
On 2011-08-23 08:52, Andrei Alexandrescu wrote:
> On 8/22/11 11:30 PM, Jacob Carlborg wrote:
>> 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.
>
> A static method of whom?
>
> Andrei
Well, "register" currently an instance method of Serializer so I would
change it to be a static method of Serializer.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list