[ENH] Use of EndOfStream (sm)

Boris Gaertner Boris.Gaertner at gmx.net
Mon Dec 29 19:01:31 UTC 2003


This proposal is for Squeak 3.7alpha #5623

We have a resumable exception  EndOfStream, that we do
not use. The comment of that exception reads:

  'Signalled when ReadStream>>next encounters
   a premature end.'

but this is not true.

In ReadStream>>next, we have: 

next
   <primitive: 65>
   position >= readLimit
      ifTrue: [^nil]
      ifFalse: [^collection at: (position _ position + 1)]

To really use the exception hanlding mechanism,
we have to replace the  "^nil" with

  ^EndOfStream new signal.

The default action of  EndOfStream returns the value nil.
This is compatible with the current behavior of 
method "next". It is therefore not necessary
to modify the senders of this message.

The attached change set contains this change for several
kinds of streams.

Greetings, Boris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: UseEndOfStream-bg.1.cs
Type: application/octet-stream
Size: 2086 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20031229/128b5caa/UseEndOfStream-bg.1.obj


More information about the Squeak-dev mailing list