streaming redux

Sean Kelly sean at invisibleduck.org
Tue Dec 28 10:07:56 PST 2010


Michel Fortin Wrote:
> 
> So because of all this virtual dispatch and all this rigidity, I think 
> Formatter needs to be rethought a little. My preference obviously goes 
> to satically-typed formatters. But what I'd like to see is something 
> like this:
> 
> 	interface Serializable(F) {
> 		void writeTo(F formatter);
> 	}
> 
> Any object can implement a serialization for a given formatter by 
> implementing the interface above parametrized with the formatter type.

I like it.  There needs to be some way to hold format-specific state info for a stream though.  I guess this could be done via an external hash (stream address to formatter state), but it would be nicer if this could be stored in the stream itself somehow.


More information about the Digitalmars-d mailing list