Should ReadStream>>next signal EndOfStream?
arning at charm.net
Thu May 18 02:26:42 UTC 2000
On Thu, 18 May 2000 03:35:46 +0200 Helge Horch <Helge.Horch at munich.netsurf.de> wrote:
>Helge, meet Embarassment.
Don't be embarassed - I've just run across some of those methods before.
>Sorry if I broke eekMail...
I'm still running that on 2.5 so no danger there.
>Unless other embarassing flaws remain, I shall release the port tomorrow
>(well, actually today, but after a good night's (whatever remains of it)
As a slight modification, I would suggest
"Primitive. Answer the next object in the Stream represented by the
receiver. Fail if the collection of this stream is not an Array or a String.
Fail if the stream is positioned at its end, or if the position is out of
bounds in the collection. Optional. See Object documentation
position >= readLimit
ifTrue: [^EndOfStream signal]
ifFalse: [^collection at: (position _ position + 1)]
This change allows the exception to be caught and a different value returned. Compare the results of:
| s |
s _ ReadStream on: Array new.
do: [ :ex | ex resume: 'that''s all there is']) inspect.
with both versions of #next to see the difference.
More information about the Squeak-dev