Hi,
I'm starting to familiarize myself with new streams, and one thing I've noticed is the removal of #lineEndConvention (which I use all the time).
So a statement like this
aFile writeStreamDo: [ :stream |
stream lineEndConvention: #lf.
stream << '...'
].
has to be written like so
aFile writeStreamDo: [ :rawStream | |stream|
stream := (ZnNewLineWriterStream on: rawStream) forLf.
stream << '...'
].
which feels very messy because I am mixing writing with the configuration. And I don't even take account for buffered/encoded decorators. Plus it increases the incidental complexity -- I need another variable, and I can accidentally write to the wrong stream, etc.
Would a method like #writeStream:do: (or #writeStreamTransform:do:) make sense? E.g.
aFile writeStreamTransform: [ :stream | (ZnNewLineWriterStream on: stream) ] do: [ :stream |
stream << '...'
]
To separate the composition from the usage?
Thanks,
Peter