Way of indicating an error

J J azreal1977 at hotmail.com
Tue Mar 6 19:07:12 UTC 2007


>From: "Damien Cassou" <damien.cassou at gmail.com>
>Reply-To: The general-purpose Squeak developers 
>list<squeak-dev at lists.squeakfoundation.org>
>To: "The general-purpose Squeak developers 
>list"<squeak-dev at lists.squeakfoundation.org>
>Subject: Re: Way of indicating an error
>Date: Mon, 26 Feb 2007 17:54:53 +0100
>
>>But consider also how those same languages handle the problem of "item
>>not found", whether it's not finding a substring in a larger string,
>>an object in a collection, or a web resource. Nearly always, the
>>programmer expects to check for the possibility that the item wasn't
>>found, and so it's natural in those cases to return nil (or whatever)
>>to say so. Only a few raise an exception when something isn't found.
>>Smalltalk's common way of having an #...ifNotFound: block is another
>>kind of exception handling.
>
>What would you expect from iterating over #(1 nil 2) ? The second
>#next will return nil. But it does not indicate the end of stream.
>
>--
>Damien Cassou
>

Sounds easy then.  If there is no suitable return value, then exceptions are 
the way to go.  You might still provide #next:ifAtEnd: or some such in case 
the user has some other option.

_________________________________________________________________
Find what you need at prices you’ll love. Compare products and save at MSN® 
Shopping. 
http://shopping.msn.com/default/shp/?ptnrid=37,ptnrdata=24102&tcode=T001MSN20A0701




More information about the Squeak-dev mailing list