[squeak-dev] Ideas about sets and dictionaries round #2
Levente Uzonyi
leves at elte.hu
Fri Nov 20 00:48:49 UTC 2009
On Tue, 17 Nov 2009, Ralph Johnson wrote:
> On Mon, Nov 16, 2009 at 7:11 PM, Levente Uzonyi <leves at elte.hu> wrote:
>> Hi,
>>
>> Round #1 was mostly about sets containing nil, and the winner seems to be
>> the object-oriented solution implemented by Igor:
>> http://bugs.squeak.org/file_download.php?file_id=3829&type=bug
>>
>> What about the other ideas?
>>
>> - create a common superclass (HashedCollection) for Set and Dictionary
>
> I think a better solution is to give Set and Dictionary a common
> component, a HashTable. I've seen this done several times and it
> always resulted in a clean design. The major drawback is that
> MethodDictionary doesn't fit that design, and the VM needs to know the
> format of MethodDictionary.
I've been thinking about this a lot before I uploaded the latest changes,
but I came to a decision that if were using encapsulation instead of
inheritance, we would have to duplicate the common interface methods. Also
performance would be worse (extra message sends) mainly because HashTable
would have to behave differently in Set and Dictionary. So I decided to
sacrifice a bit of clarity for simplicity and performance.
Levente
>
> -Ralph
>
>
More information about the Squeak-dev
mailing list
|