Another useful snip

Dan Ingalls Dan at SqueakLand.org
Fri Mar 18 01:47:03 UTC 2005


About four years ago, I got serious about partitioning the system as part of the Environments project.  Since I have a small brain I wrote a Squeak method to help, which is still in the system (except that it got broken by some effort to split up SystemDictionary :-(  :-(.  A fix is attached).  Anyway, consider...

    Smalltalk reportClassAndMethodRemovalsFor: #(Celeste Scamper MailMessage)

This grinds for a few minutes, and then *automagically*produces an array of two very useful results.  The first is an IdentitySet containing 63 classes that can all be removed together with the original 3 without leaving any broken links:
---------
HtmlBoldEntity HtmlDefinitionTerm HtmlHorizontalRule HtmlSubscript HtmlBiggerFontEntity HtmlSmallerFontEntity HtmlComment HtmlInput CelesteCategoryFilter HtmlListItem RadioButtonInput HtmlUnorderedList ScaffoldingCeleste HtmlBlockQuote HtmlArea HtmlTitle ToggleButtonInput HtmlForm MorphicTextEditor HtmlTokenizer HtmlDefinitionDefinition HtmlTag HtmlStyle CelesteCodeFilter HtmlDocument FormInputSet HtmlMap HtmlOption DHtmlFormatter HtmlTable HtmlItalicsEntity HtmlTableHeader TextMessageLink SelectionInput MailMessage Celeste HtmlBody HtmlOrderedList HtmlParagraph WebPageMorph HtmlSelect HtmlFontEntity HtmlOptionGroup HtmlTableRow HtmlParser HtmlDefinitionList HtmlNoEmbed HtmlPreformattedRegion HtmlHead HtmlBreak HtmlAnchor RadioButtonSetInput HtmlSuperscript HtmlUnderlineEntity HtmlFixedWidthEntity FileInput HtmlFrame HiddenInput HtmlStrikeEntity HtmlTextArea HtmlCommentEntity HtmlEmbedded Scamper
----------
Really.  How long would it take to figure this out by hand?

And that's not all...  The second element is an IdentitySet containing 253 selectors sent only by these 63 classes.  These are essentially all the "extensions" to other classes.  I won't list them, but you can run the code and see for yourself.

But wait, there's more...   Check out SystemDictionary fileOutAndRemove: (which doesn't really remove anything ;-).  This method accepts the tuple produced above (oops you need to coerce the first to an Array), and produces a fileOut of all the classes and extension methods -- essentially a complete Package.  I just tried it and got a 321K file.  At the time I wrote this code, you could file the resulting file into a Squeak image after removing all the above and then run Scamper and Celeste again just fine.

I have been encouraging the Splitters and Packagers to try this out, but I thought others on this list might enjoy it as well.  Hopefully the attached fix will encourage people who might have tried it and failed.

What it tells us is, wherever we can identify approipriate root classes, packaging may not be all that hard.

Enjoy
	- Dan

PS:  If you are curious how this works, it is very simple.  It is explained in...
http://discuss.squeakfoundation.org/cgi-bin/ezmlm-cgi?11:mss:42:200503:echjfhegcncflbfeeofe
-------------- next part --------------
Skipped content of type multipart/appledouble


More information about the Squeak-dev mailing list