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
wrong?
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
help?