Tips and tricks?
Colin Putney
cputney at wiresong.ca
Tue Mar 9 20:20:01 UTC 2004
On Mar 9, 2004, at 3:04 PM, Andreas Raab wrote:
> Q: Say you have an extension in some class which requires an extra
> class
> variable. How would you get that class variable into a system, given
> that MC
> doesn't really track such changes?
>
> A: You make a class side #initialize methods which looks like:
>
> Foo class>>initialize
> "Make sure that the class variable is present"
> (self classPool includesKey: #MyVariable) ifFalse:[
> self addClassVar: #MyVariable.
> ].
> MyVariable := 42.
Nice.
I use something similar in OmniBrowser. One of my tests needs to make
sure that image browsers see an extension method on particular class,
but package browsers don't (because they're browsing the package that
the class belongs to, not the extension.) Since the extension has to be
in a different package, (ie, not OmniBrowser), I create it in a
class-side initialize method.
It won't be hard to have Monticello support your situation properly,
once there are mechanisms in the kernel for annotating variables.
Cheers,
Colin
More information about the Squeak-dev
mailing list
|