Range interface for std.serialization

Dicebot public at dicebot.lv
Thu Aug 22 08:49:04 PDT 2013

On Thursday, 22 August 2013 at 15:33:07 UTC, Johannes Pfau wrote:
> The reason is simple: In serialization it is not common to 
> post-process
> the serialized data as far as I know. Usually it's either 
> written to a
> file or sent over network which are perfect examples of Streams 
> (or
> output ranges).

Hm but in this model it is file / socket which is an OutputRange, 
isn't it? Serializer itself just provides yet another InputRange 
which can be fed to target OutputRange. Am I getting this part 

> But InputRanges are limited to the same type for all elements, 
> the
> "serialize" call isn't.

I was thinking about this but do we have any way to express 
non-monotone range in D? Variant seems only option, it implies 
that any format used by Archiver must always store type 
information though.

> Of course you can use Variant. But what about
> big structs?

After some thinking I come to conclusion that is simply a matter 
of two `data` ranges - one parametrized by output type and other 
"raw". Latter than can output stuff in string chunks of undefined 
size (as small as serialization implementation allows). Does that 

More information about the Digitalmars-d mailing list