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
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to