streaming redux

sclytrack sclytrack at fake.com
Tue Dec 28 15:09:12 PST 2010


class SerializableObject
{
  void describe( PropertyDescription d )
  {
     d.addProperty(...)
  }
}


== Quote from Sean Kelly (sean at invisibleduck.org)'s article
> 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