[squeak-dev] The Trunk: Multilingual-fbs.164.mcz
Frank Shearar
frank.shearar at gmail.com
Wed Jul 3 08:43:40 UTC 2013
On 3 July 2013 02:46, Chris Muller <asqueaker at gmail.com> wrote:
>> The last remaining dependency is:
>>
>> LanguageEnvironment class >> startUp
>> self clearDefault.
>> Clipboard startUp.
>> HandMorph startUp.
>>
>> I am stumped as to how to preserve this behaviour and sever the
>> dependency. Smalltalk at: #HandMorph is _not_ a solution. It makes
>> things worse because you hide the dependency, but it's still there,
>> ready to bite you at a random moment.
>
> Not sure why it "hides it" since references to HandMorph would still
> find it.
You couldn't use "class references" (alt-shift-n) to find the
dependencies and the Dependency Browser wouldn't be able to find it.
> Would it still bite even with a guard?
>
> (Smalltalk classNamed: #HandMorph) ifNotNil: [ : cls | cls startUp ]
>
> I suppose if someone loaded Multilingual _first_ one could get bitten
> by not starting the Clipboard? Not sure about that..
Yes. But also it's the wrong thing; the dependency is inverted. In
order to support some new shiny feature that needs state reset when
the LanguageEnvironment changes, I'd need to affect the base
infrastructure. I guess what I'm looking for is a callback or
announcement mechanism. "Hey guys, the LanguageEnvironment has
changed", and then Clipboard and HandMorph can say "oh right, I must
<insert state change>".
>> Inlining the above into Language class >> #startUp's call sites
>> seems... undesirable.
>>
>> Perhaps a startup registry, and HandMorph's and Clipboard's
>> #initialize would say something like LanguageEnvironment
>> registerForStartup: self ?
>
> What about Smalltalk addToStartupList:after:?
It's not an image startUp thing, but rather LanguageEnvironment class
>> #startUp is called when the Locale changes, and a few other places.
frank
More information about the Squeak-dev
mailing list
|