streaming redux
Sean Kelly
sean at invisibleduck.org
Tue Dec 28 14:19:01 PST 2010
Michel Fortin Wrote:
> On 2010-12-28 13:07:56 -0500, Sean Kelly <sean at invisibleduck.org> said:
>
> > 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);
> >> }
>
> The 'F' formatter can be anything, it can be a class, a delegate, a
> struct (although for a struct you might want to pass it as 'ref')... so
> it *can* hold a state. Or am I missing something?
And I guess writeTo could just call formatter.write(MyClass c). You're right, that works.
More information about the Digitalmars-d
mailing list