Experience with Java taught me to loath ethe "do I/O
by composing lots of little wrappers" approach for
several reasons:
��- the fact that the commonest case was not the
���� default case, so that simple obvious code was
���� somewhere between disgracefully slow and wrong
��- the extra complexity needed to get it right
���� (having to know a plethora of wrapper classes
���� instead of just getting sensible defaults)
��- the poor performance.
In my own Smalltalk system I hewed to the ANSI
Smalltalk standard and if you do
������ FileStream read: aFileName
or�� FileStream write: aFileName
you get a text file using the encoding set by
your environment's locale, the native line ending
convention, Simple, easy, and leaves Java's
I/O performance in the dust.
Of course wrappers are available for the rare
cases when you need them, but you don't _have_
to use them.�� One reason this matters is that
there are two ways to write a stream:
�� s2 := WrapperClass on: s1
������ -- closing s2 just closes s2, not s1.
�� s2 := WrapperClass onOwn: s1
������ -- closing s2 closes s1 as well
And yes, both of these *are* used.