Stream>>Skip: ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Stream>>Skip: ?

Chris Uppal-3
What is the correct behaviour of Stream>>skip: ?  ANSI states that
<getableStream>s adjust the parameter so as not to read off the end of the
stream (ANSI is silent on negative values passed to #skip:).  The Dolphin
FileStreams adjust the position to remain within bounds.  SequencableStream, on
the other hand, will throw errors, even though the documentation states that it
will not.  E.g. try

    'Hello' readStream skip: 10.
    'Hello' readStream skip: -1.

Is this a case where the semantics of a selector are not particularly
well-defined (and the SequencableStream implementation is OK but its comment is
wrong), or is SequencableStream>>skip: buggy ?   I'd hope that such a generic
feature of <stream>s would have the same behaviour in all cases (within sane
limits), but maybe the inconsistency is something inherited from older
Smalltalk implementations.

    -- chris