[ANSI-Smalltalk] #contents on <collectionStream>
Richard O'Keefe
ok at cs.otago.ac.nz
Mon Oct 20 03:56:16 BST 2008
On 19 Oct 2008, at 11:00 am, Paolo Bonzini wrote:
>
> Let's try however to follow current practice and not invent new
> selectors.
Current practice conflicts with the standard.
What the standard recommends is self-consistent;
what current practice does is not.
However, current practice has not caught up with the
standard in the last 10 years.
The Blue Book says (p196):
contents Answer all of the objects in the
collection accessed by the receiver.
Generally, the answer will be a
collection o the same class as the
one accessed by the receiver.
This is ambiguous in the case of a stream created by
ReadStream on: aCollection from: firstIndex to: lastIndex;
are the objects "in the collection" those in aCollection or
those in aCollection from: firstIndex to: lastIndex?
Page 198 says that in this case "a copy of a subcollection of
aCollection is accessed", which makes all clear. With VA,
VW, and Squeak all truncating according to position for
WriteStream, it seems that the bug (or if you think it is not
a bug, the inconsistency between WriteStream and ReadWriteStream)
may go back to Smalltalk-80, but you wouldn't know if from the
Blue Book.
If the bug does indeed go back 28 or 29 years, then it is
futile for the standard to rage against it. To get something
like #contents that is consistent across all of
ReadStream, WriteStream, ReadWriteStream, we have to abandon
#contents to implementation-defined behaviour and yes,
we have to invent new selectors.
be
More information about the ANSI-Smalltalk
mailing list