Chances of D getting proper runtime reflection?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Aug 22 12:16:31 PDT 2011


On 8/22/11 1:41 AM, Jacob Carlborg wrote:
> On 2011-08-22 00:35, Andrei Alexandrescu wrote:
>> On 8/21/11 1:19 PM, Jacob Carlborg wrote:
>>> On 2011-08-21 17:30, Robert Clipsham wrote:
>>>> On 21/08/2011 16:05, Jacob Carlborg wrote:
>>>>> 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.
>>>>
>>>> You don't need to annotate it:
>>>>
>>>> void serialize(T)(T something);
>>>>
>>>> You have access to all the CT reflection stuff, and can generate the
>>>> necessary runtime reflection with that.
>>>
>>> I already have a fully working serialization library. I'm hoping to make
>>> it better. The problem is when (de)serializing through a base class
>>> reference. Currently you need to register the subclass with the
>>> serializer. If T is Base and the actually runtime type is Sub it won't
>>> work.
>>
>> If we get to the point where adding one line of code inside or
>> (preferably) outside a type to make it serializable, that would be great.
>>
>> Andrei
>
> That's already what I have and it's only necessary to register
> subclasses that are serialized through base class references. If we get
> runtime reflection as I suggested in my original post, that wouldn't be
> needed.

FWIW I don't think D should pay the cost of reflection up-front and 
compulsively for all types.

If David's code example is what you have, I don't think Orange got 
"making a class serializable" properly yet.


Andrei


More information about the Digitalmars-d mailing list