[squeak-dev] Re: Sets with nil (Was: Ideas about sets and dictionaries)

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Thu Nov 12 10:15:32 UTC 2009


2009/11/12 Andreas Raab <andreas.raab at gmx.de>:
> Levente Uzonyi wrote:
>>
>> But we now have a lot more proposals, let me summarize them all:
>>
>> - (1)add a new instance variable: containsNil
>> - (2)use tally to indicate if nil is in the set
>>  - (a)negative values mean nil is contained by the set
>>  - (b)floats - (3)use a marker object
>>  - (a)self
>>  - (b)a unique object in each set
>>  - (c)a class variable
>> - (4)use container objects in occupied slots, like associations in
>> dictionaries
>>
>> I prefer 3c, 2a, 3a, 1, 4 in the given order.
>> What about you?
>
> Nice summary. My current preferences would be (1) (clear and obvious) (3b)
> (ditto) and (3a)/(3c) (both with some hesitation). I'm not sure about (4)
> (I've only just heard of it; it sounds cool but I haven't seen no code yet).
> I would veto both (2a) and (2b) as obscure hacks compared to (1) unless the
> size overhead is significant.
>
> Cheers,
>  - Andreas
>
>

Of course, I agree to split Set and Dictionary.

I like 2a) trick, and see no problem if it is well documented and
properly isolated
2b) seems a bit too vicious to me, beside, i don't like Float ;)
Otherwise, I would go for 1)

Nicolas



More information about the Squeak-dev mailing list