[squeak-dev] Re: Squeak-dev Digest, Vol 79, Issue 56

Ralph Boland rpboland at gmail.com
Mon Jul 20 14:34:37 UTC 2009


>> I have been looking at MethodDictionary.
>> It seems to have very little to do with Methods.
>> It seems to me that a better design would have been
>> to have a class VarDictionary which does not use
>> Associations (similar to MethodDictionary).
>> MethodDictionary would inherit from VarDictionary
>> and add the couple of additional methods it needs.
>> VarDictionary would then be available for others to use.
>>
>> Better still would be to have MethodDictionary not
>> be a variable class at all but simply use an additional
>> variable  "values".  Again MethodDictionary should
>> really inherit from a class that provides this service.
>> I would use this service in my own code.
>>
> This will increase a method lookup times & lengthen the path for
> accessing the methods by VM.
> Don't forget, that MethodDictionary having such special format only
> because to satisfy VM.
>
>> Ralph Boland
>>
>>

> Igor Stasenko AKA sig.

Makes sense.
Perhaps the MethodDictionary class comment could spell this out more clearly.

Currently it says:

I am just like a normal Dictionary, except that I am implemented
differently.  Each Class has an instances (should be instance) of
MethodDictionary to hold the correspondence between selectors (names
of methods) and methods themselves.

In a normal Dictionary, the instance variable 'array' holds an array
of Associations.  Since there are thousands of methods in the system,
these Associations waste space.

Each MethodDictionary is a variable object, with the list of keys
(selector Symbols) in the variable part of the instance.  The variable
'array' holds the values, which are CompiledMethods.



More information about the Squeak-dev mailing list