[squeak-dev] Re: Sets with nil

Bert Freudenberg bert at freudenbergs.de
Thu Nov 12 16:53:04 UTC 2009


On 12.11.2009, at 16:22, Randal L. Schwartz wrote:

>>>>>> "Bert" == Bert Freudenberg <bert at freudenbergs.de> writes:
> 
> Bert> I'd prefer (3d): make a class called UnoccupiedSlot, use it as marker
> Bert> (either the class itself [I'd like that] or its singleton instance [for
> Bert> the purists]). This would make it blatantly obvious what's happening
> Bert> when inspecting the innards of a Set.
> 
> The problem with that is that you're simply moving the problem.
> 
> Now I can't have a Set of all classes. :(
> 
> That's the beauty of my "each set contains its own unique nil marker"
> solution.  Any set can contain anything except its own insides, which is a
> limitation that would only occur if you're doing something very very nasty.  A
> set of all classes is far more likely to occur.

I concur. It still could be an UnoccupiedSlot instance, though "Object new" works just the same except if you basic-inspect a Set.

This still feels "cleaner" to me than the extra "contains nil" flag / tally hack. Besides, we'd end up with net code savings, basically moving the stuff from WeakSet up to its super class.

- Bert -




More information about the Squeak-dev mailing list