Feb. 6, 2009
12:31 p.m.
Hi all, The method add: in the class Set return an error if the parameter is nil. Maybe, we can return nil and manage the error outside the method. Currently, the method is --- | index | newObject ifNil: [self error: 'Sets cannot meaningfully contain nil as an element']. index := self findElementOrNil: newObject. (array at: index) ifNil: [self atNewIndex: index put: newObject]. ^ newObject --- We can do something like this. (the same as VisualWorks) --- | index | newObject ifNil: [^newObject]. index := self findElementOrNil: newObject. (array at: index) ifNil: [self atNewIndex: index put: newObject]. ^ newObject --- Jannik