[Cuis-dev] AssertionFailure in prePackageInstall of package Morphic-Misc1

ken.dickey at whidbey.com ken.dickey at whidbey.com
Wed Dec 22 07:58:12 PST 2021


On 2021-12-22 02:33, Bernhard Pieber via Cuis-dev wrote:
..
> Feature require: 'Morphic-Misc1‘.
> 
> This results in a debugger in MorphicMisc1Package class>> 
> prePackageInstall.
> 
> The reason is that Morph>>#changeColor does not have a timestamp
> currently.

Hmmm.. I just
   Feature require: 'Morphic-Misc1'
without error.

You will see the above behavior if you load 'Morphic-Misc1' more than 
once.

THEORY OF OPERATION

So the base #Morph>>changeColor method does _not_ change a Morph's 
color.

Morphic-Misc1 is replacing the base image #changeColor method with one 
which _does_ change the color of a Morph.

To replace base image methods, it is good practice to check that you are 
replacing the method you think you are replacing.

The simple way is to match the timestamp of the original method.

It is best if this is done _before_ loading the package code which 
actually does the replacement.  And the way to do that is to make a 
subclass of CodePackage and place a check in its #prePackageInstall 
class method.

Note #MorphicMisc1Package class>>prePackageInstall.

OK.  So if you load Morphic-Misc1, and then load it again (e.g. from the 
file list), the #Morph>>changeColor method will have been updated from 
the first load and the timestamp match will fail.

At this point I have to apologize because I got lazy (did I tell you I 
was lazy?) and just put in an #assert: rather than a popUp with more 
information.

I will try to do more testing and get to this within the next couple of 
days to replace the assert with a hopefully informative choice popup.

Thanks much for reporting this!

I am trying to be a better person, but I am lazy!  8^|

-KenD



More information about the Cuis-dev mailing list