Range interface for std.serialization

Jacob Carlborg doob at me.com
Wed Aug 28 11:37:19 PDT 2013


On 2013-08-28 13:20, Dmitry Olshansky wrote:

> Taking into account that you've settled on keeping Serializers as
> classes

Not necessary.

> just finalize all methods of a concrete serializer that is
> templated on archiver (and make it a final class).
>
> Should be as simple as:
>
> class Serializer {
>      void put(T)(T item){ ...}
>      //other methods per specific type
> }
>
> final class ConcreteSerializer(Archiver) : Serializer {
> final:
>      ...
>      //use Archiver here to implement these hooks
> }
>
> Then users that use templates in their code would have concrete types,
> for others it quickly "decays" to the base class they use.
>
> The boilerplate of defining a lot of methods now moves to Serializer but
> there should be only one such (template) class anyway.

This is a good idea.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list