[Newbies] Re: monticello package - adding instance variables toexisting classes

Keith Hodges keith_hodges at yahoo.co.uk
Sun Nov 18 04:09:34 UTC 2007


 
>>
>> For the most part, this is the reason for the restriction. I
>> would consider it a bug.
>   <snipped>
>
> For plain MC you can hack around it with the meta sword, as usual.
>
> - Bert -
Yes indeed a missing feature.

MC1.5 has hooks for it, you define a methods prefixed #mcInstall /
#mcUninstall #mcAfterInstall / #mcAfterRemoval

e.g.

SomeoneElsesClass-mcOnInstallAddVarNewVarName: aClassEditor {
*mypackagecategory }

"This code gets run on installing the package before the new package is
committed to the image.
In the method you are passed the class to which you can make any changes
you wish. e.g."

aClassEditor addInstVarName: 'bob'

....

Unfortunately however these hooks were designed to be used with the new
SystemEditor based atomic loading scheme, and does not work out of the
box with the current release.

However you have just inspired me fix that so.. use at your own risk.

MC1.5 with these hooks enabled is in http://mc.squeaksource.com/mc

best regards

Keith










More information about the Beginners mailing list