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

Levente Uzonyi leves at elte.hu
Thu Nov 12 14:48:44 UTC 2009


On Thu, 12 Nov 2009, Bert Freudenberg wrote:

>
> On 12.11.2009, at 14:30, Jecel Assumpcao Jr wrote:
>
>> Levente Uzonyi wrote:
>>>> Which message send would you save in
>>>>
>>>> 	... == UnoccupiedSlot
>>>>
>>>
>>> UnoccupiedSlot instance.
>>> I wouldn't use a class, because I think we should be able create a set
>>> with any classes in it.
>>
>> Indeed - I am sure there are several places in the image that deal with
>> sets of all classes or all globals.
>
> Good point.
>
>> One example of a Smalltalk with a non nil object to mark empty slots in
>> sets is Self, so it has been done before. On the other hand, Self
>> doesn't use associations but instead implements dictionaries with two
>> parallel arrays.
>
> It has even been done in Squeak - see class WeakSet.

That's right. And with a "global" flag its implementation could be 
simpler. It won't be able to contain nil with the marker based 
implementations, but it's not a real issue IMO.

Levente



More information about the Squeak-dev mailing list