Set>>add: should ignore nil argument

Roel Wuyts Roel.Wuyts at ulb.ac.be
Fri Aug 13 07:02:32 UTC 2004


Noooooooo !!! Do not start to use exceptions for this kind of control 
flow!!! It is not an exception. Making it an exception will get you 
into all kinds of trouble...

The nil is basically just a sentinel value. If you really need to store 
it, choose another sentinel. An object with a similar protocol as nil 
should more or less do the trick.

On 12 Aug 2004, at 12:03, Marcin Tustin wrote:

> On Thu, Aug 12, 2004 at 11:50:55AM +0200, radoslav hodnicak wrote:
>> On Thu, 12 Aug 2004, Marcin Tustin wrote:
>>
>>>     What if I *want* to store a nil value in a set
>>
>> Then you have to find a smalltalk dialect that allows it.
>
>     OR I could use one that raises an exception, thus allowing
> me to detect that I need to use a hack without using a wrapper
> that tests every single item inserted for being nil. Which
> Squeak allows.
>
>
Roel Wuyts                                                              
   DeComp
roel.wuyts at ulb.ac.be                               Université Libre de 
Bruxelles
http://homepages.ulb.ac.be/~rowuyts/                                    
Belgique
Board Member of the European Smalltalk User Group: www.esug.org




More information about the Squeak-dev mailing list