[squeak-dev] Re: Sets with nil
andreas.raab at gmx.de
Thu Nov 12 23:47:54 UTC 2009
Levente Uzonyi wrote:
> Sets are not meant to be used for error detection.
Precisely. The issue is about consistency, not error handling.
Take this, for example:
Array with: nil.
OrderedCollection with: nil.
Bag with: nil.
Set with: nil.
If the first three work, why wouldn't the last? Or this one:
(OrderedCollection new) add: nil.
(Bag new) add: nil.
(Dictionary new) at: nil put: nil.
(Set new) add: nil.
If the first three work, why doesn't the last one? All of the above
claim to be general purpose collections (i.e., contrary to collections
that only store certain kinds of objects such as ByteArray or String).
In this context it seems just silly that Set wouldn't store nil given
that Array, OrderedCollection, Bag, Dictionary can store nil just fine.
More information about the Squeak-dev