[Cuis-dev] [RFC] Namespaces, changes to SystemDictionary, Object and a dictionary class for tracking environment implementations
Gerald Klix
cuis.01 at klix.ch
Mon Oct 5 08:40:53 PDT 2020
On 2020-10-05 17:28, Gerald Klix via Cuis-dev wrote:
> On 2020-10-05 17:03, Juan Vuletich via Cuis-dev wrote:
>> On 10/5/2020 7:22 AM, Gerald Klix via Cuis-dev wrote:
>>> Hi all, hi Juan,
>>>
>>> here comes the announced monster change set.
>>> I hope it "Carries it's own wait."
>>>
>>> I added a EnvironmentImplementationDictionary class and changed all
>>> relevant methods in SystemDictionary to ask the single instance of
>>> EnvironmentImplementationDictionary if some
>>> implementation can handle the request.
>>>
>>> It is the simplest implementation I can think
>>> of, that is consistent with your statement:
>>> "Yes. I want Cuis to be a good place for doing any kinds of
>>> experiments. Adding hooks for optional pluggable behavior is a big
>>> part of that."
>>>
>>> Please tell me if this is acceptable or
>>> to big a change.
>>>
>>>
>>> Best Regards,
>>>
>>> Gerald
>>
>> Hi Gerald,
>>
>> The size of the change is reasonable. What I'm not sure I like is the
>> fact that an instance of EnvironmentImplementationDictionary still
>> gets created and its code run even if there are no Environments
>> implementations at all. I think it would be better not to have the new
>> global, and, for example in #fillCaches, instead of what you suggest:
>>
>> self environmentImplementations
>> fillClassNameCache: classNames
>> andNonClassNameCache: nonClassNames.
>>
>> it would be better to do something like:
>>
>> self environmentImplementationIfPresentDo: [ :environments |
>> environments
>> fillClassNameCache: classNames
>> andNonClassNameCache: nonClassNames ].
>>
>> and #environmentImplementationIfPresentDo: will only evaluate the
>> argument block if there is an environment implementation to delegate
>> to. This way EnvironmentImplementationDictionary is no longer needed
>> in the base image.
>>
>> Thanks,
>>
>
> Hi Juan, Hi all.
>
> I started the way you suggested, but I soon came
> to the conclusion, that this is less readable
> than the straightforward implementation.
> I avoids one seemingly useless class
> for 11 or more methods being more
> complicated and it might add one more dictionary
> lookup to all this methods
> (Hidden behind #environmentImplementationIfPresentDo).
>
> I am not sure what the most efficient
> implementation for the case of
> "no environment implementations installed" is.
> If I had to guess, I would suppose it is an
> EnvironmentImplementationDictionaryDummy
> that avoids the (empty) iterations and
> answers the values for the "nothing found case".
> (This is based on the assumption that the JIT
> inlines methods answering constants).
> If this is the case we can add such a
> dummy environment implementation manger
> as an optimization.
>
> Perhaps someone with more knowledge about the
> JIT -- Eliot for example -- can answer this
> question.
>
>
> Best Regards,
>
> Gerald
>
On a second thougt:
Based on the assumption about the JIT, mentioned in my previous email,
we could also add an empty
#environmentImplementationIfPresentDo: method
and overwrite it in an EnvironmentsBase package.
The later I am writing right now.
The various methods in the system dictionary
will be a bit more complicated, but if the BDFL
is OK with that, it's certainly OK for me :)
Just my 0.01€,
Gerald
More information about the Cuis-dev
mailing list