Le 17/04/2012 08:26, Jacob Carlborg a écrit :
On 2012-04-16 22:42, Timon Gehr wrote:

This could be fixed by introducing a simple language feature that allows
a supertype to specify mixin templates that are 'inherited' by all
subtypes.

Eg:

interface ISerializable {
ubyte[] serialize();

super mixin Serialize;
}

Then it won't be possible to serialize third party types if they don't
implements ISerializable. In this case, this solution is no better then
manually registering types. Actually it's worse, since I can manually
register third party types.


Any type that mixin Serialize would be serializable, which is pretty nice.

Another way would be to inherit attribute. Then a runtime reflection script can retrieve all declaration with a given attribute.

Reply via email to