Network+Files teams merge into I/O team

David Shaffer cdshaffer at acm.org
Wed Jan 4 21:09:33 UTC 2006


David Shaffer wrote:

>
>I think that the problem is that it is a Notification.  Easily ignored
>but as soon as you put a "catch all" handler ([] on: Exception do: [:ex|
>...]) around a segment which raises it you all-of-a-sudden start seeing
>these exceptions.  I could be wrong here but I think that's the
>problem.  I think that catching Exception is generally not a good idea
>though.
>  
>

Now it's coming back to me....the problem is when you nest I/O.

[self doSomethingWith: someStream next] on: EndOfStreamNotification do:
[:ex | ]

causes problems if doSomethingWith is written as:

doSomethingWith: someObject
    [someOtherStream atEnd] whileFalse: [someOtherStream next]

because the "someOtherStream next" will eventually raise
EndOfStreamNotification which will be caught by the outer handler.  Of
course in real life you get tripped up by a method you didn't write
which follows a convension you didn't expect (maybe you didn't even know
it used a stream!).

David




More information about the Squeak-dev mailing list