[squeak-dev] Re: Letting Set contain nils?

Hans-Martin Mosner hmm at heeg.de
Sun Aug 10 15:45:14 UTC 2008


Igor Stasenko schrieb:
>
> My point is to make sets which can contain ANY object without discrimination.
>   
this topic has probably already been beaten to death, but here's another
idea:
Since sets need to mark unused slots and use nil for that purpose, they
cannot contain nil directly.
But it would be simple to just add an instance variable 'includesNil'
which gets set to true when nil is added, and which would be used for
enumeration and inclusion testing.

Regarding the fear that making sets accept nil would break existing
code: it would not, but it would probably encourage users to write code
which won't work on other Smalltalk systems where this is not supported,
so in the interest of easier code interchange I'd leave it out, even
though it would make some sense in certain situations.

Cheers,
Hans-Martin



More information about the Squeak-dev mailing list