Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Analysis - What needs to be done to unload Etoys?
Last updated at 12:22 pm UTC on 20 August 2020
The assumption is that you have a Squeak 5.2 or 5.3 release image (with updates included) and want to find out what the reasons are that is is not possible to unload Etoys.

If you are not interested in this analysis just go to How to unload Etoys from Squeak 5.3 where the results are gathered and if you follow the steps it gives you a good experience with an image without Etoys.


So this page is about finding out what causes are and also to find out if there are remaining issues where code in the reduced image is called but the method has been removed.

This attempt shows the strategy to search for errors. It may serve as an example to look for more issues.
The result of this has been included in the description of How to unload Etoys from Squeak 5.3


Do this in a prestine image. Hide menu bar.

ReleaseBuilder discardUserObjects.
Player removeUninstantiatedSubclassesSilently.
MorphicModel removeUninstantiatedSubclassesSilently.

"Metaclass allInstances size  2737"
SystemOrganization removeCategoriesMatching: 'Etoys-Squeakland*'.
SystemOrganization removeCategoriesMatching: 'Etoys-*'.
Smalltalk garbageCollect.
Metaclass allInstances size   2276


 SystemNavigation default allClasses
		do: [:cls | cls organization categories
				do: [:org | (org beginsWith: '*Etoys-Squeakland')
						ifTrue: [cls removeCategory: org]]]
worked. But it does not remove all Etoys related message categories.

For example in class morph the following protocols remain:

Morph organization categories select: [:cat | (cat beginsWith: '☆Etoys-')] 
#(#'*Etoys-card in a stack' #'*Etoys-support' #'*Etoys-scripting' #'*Etoys-customevents-scripting' #'*Etoys-geometry' #'*Etoys-latter day support')

To remove those
protocolCat := Morph organization categories select: [:cat | (cat beginsWith: '*Etoys-')] .

protocolCat do: [:cat | Morph removeCategory: cat]


Save the image.

Removing all in one go freezes the image:
 SystemNavigation default allClasses
		do: [:cls | cls organization categories
				do: [:org | (org beginsWith: '*Etoys-')
						ifTrue: [cls removeCategory: org]]]

Kill the image and restart.

Find out about classes which still have Etoys protocols
SystemNavigation default allClasses
		select: [:cls | (cls organization categories
				detect: [:cat | (cat beginsWith: '*Etoys-')] ifNone: [#()]) size > 0].


An attempt to remove the etoys protocols from the classes which just have one category with them:
clsList := SystemNavigation default allClasses
		select: [:cls | (cls organization categories
				select: [:cat | (cat beginsWith: '*Etoys-')]) size = 1].

clsList do: [:cls | | protocolCat |
protocolCat := cls organization categories select: [:cat | (cat beginsWith: '*Etoys-')] .
protocolCat do: [:cat | cls removeCategory: cat]	]	


This works, the image remains responsive.

Inspect the list of classes which still have an etoys protocol

SystemNavigation default allClasses
		select: [:cls | (cls organization categories
				detect: [:cat | (cat beginsWith: '*Etoys-')] ifNone: [#()]) size > 0].


In the inspector of this list evaluate
 self do: [:cls | Transcript show: 'removeEtoysProtocolAction value: ', cls printString,'.';cr  ]


Then by trial and error find out which protocols can easily be removed and which ones not.
| removeEtoysProtocolAction |
removeEtoysProtocolAction := [:cls | (cls organization categories select: [:cat | (cat beginsWith: '*Etoys-')]) do: [:cat | cls removeCategory: cat]].

....
removeEtoysProtocolAction value: PasteUpMorph.
removeEtoysProtocolAction value: TabbedPalette.
removeEtoysProtocolAction value: SketchMorph.
removeEtoysProtocolAction value: Number.
removeEtoysProtocolAction value: StringType.
removeEtoysProtocolAction value: TextFieldMorph.
removeEtoysProtocolAction value: MorphicProject.
removeEtoysProtocolAction value: Form
removeEtoysProtocolAction value: BooleanType.
removeEtoysProtocolAction value: AlignmentMorph.
removeEtoysProtocolAction value: String.
removeEtoysProtocolAction value: GraphicType.
removeEtoysProtocolAction value: MenuType.
removeEtoysProtocolAction value: Vocabulary.
removeEtoysProtocolAction value: HandMorph.
removeEtoysProtocolAction value: PluggableTextMorphWithModel.
removeEtoysProtocolAction value: DataType.
removeEtoysProtocolAction value: PluggableTextMorph.
removeEtoysProtocolAction value: TextMorph.
removeEtoysProtocolAction value: TheWorldMenu.
removeEtoysProtocolAction value: SoundType.
removeEtoysProtocolAction value: StandardScriptingSystem.
removeEtoysProtocolAction value: ImageMorph.
removeEtoysProtocolAction value: ColorType.
removeEtoysProtocolAction value: UpdatingStringMorph.
removeEtoysProtocolAction value: Object.
....


Result 1

It turns out that only one method
Form>>isVirtualScreen
causes problems.
If this method is reclassified before unloading in Monticello the image does not hang.
However there are still more issues see How to unload Etoys from Squeak 5.3.


An issue which remains is that the debugger does not come up properly after unloading Etoys in the Monticello browser

cf: How to unload Etoys from Squeak 5.3.

One cause is that the methods #start and #stop which where in category '*Etoys-Squeakland-accessing' are no longer present

 start
	^ start

and

 stop
	^ stop

Add them to the 'accessing' method on the instance side of class Interval. Doing this fixes the issues with the debugger.
So it is better to reclassify these methods before unloading.




Notes:

Similar to 2 but will give more control in case of need.

 Metaclass allInstances size  2737

 ReleaseBuilder discardUserObjects.
 Player removeUninstantiatedSubclassesSilently.
 MorphicModel removeUninstantiatedSubclassesSilently.

Identify the categories and remove them one by one:

 etoysCategories := SystemOrganization categories select: [:category | category beginsWith: 'Etoys-Squeakland'].
 etoysCategories do: [:category | SystemOrganizer default removeSystemCategory: category].

 Metaclass allInstances size 2390


 etoysCategories := SystemOrganization categories select: [:category | category beginsWith: 'Etoys-'].
 etoysCategories do: [:category | SystemOrganizer default removeSystemCategory: category].

 Smalltalk garbageCollect.
 Metaclass allInstances size 2276