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

Igor Stasenko siguctua at gmail.com
Thu Nov 12 10:18:43 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.
>

My preferences:

[4] - 2a - 2b, 1

2a-2b, might be a hacks, but could be look as 1 with space-sufficient
optimization.

About 4. IMO would be best way, since it can be implemented right in
the spirit of smalltalk
- dispatch a message, instead of putting extra checks, sometimes
non-obvious ones (like in 2a-2b).

Anyone interesting in discussing this more deeper in another topic?

> Cheers,
>  - Andreas


-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list