[squeak-dev] Re: Ideas about sets and dictionaries
Andreas Raab
andreas.raab at gmx.de
Thu Nov 12 08:23:35 UTC 2009
Tobias Pape wrote:
> As far as I know, another approach is to have
> Distinct Entry Object inside the set. cf. the GemStone
> approach. A set, there, contains an ordered collection of
> nils an Entry elements. Thus, the actual element is stored _inside_
> the entry element, not in the underlying (storage) collection
> of the array itself. As far as I know, this is similar to its Dictionary
> approach.
Oh, that's good! One way this could be harnessed is to only wrap up
objects that otherwise couldn't be stored directly in the set. So when
you're storing nil you'd wrap it in a SetEntry and of course if you were
storing a SetEntry you would wrap that in another SetEntry. In the end,
Sets could contain every other object; most of them natively, some of
them wrapped.
Done as polymorphic implementation it could even help dealing with those
infinite collection-inside-collection hash implementations (i.e.,
CollectionSetEntry>>hash would only use a basic hash of the underlying
collection so that adding a set to itself would even work).
A very interesting idea, thanks! This actually sounds like a fun little
project - anyone up for implementing such a Set to see what that would take?
Cheers,
- Andreas
More information about the Squeak-dev
mailing list
|