system category bungle
Dan at SqueakLand.org
Mon Apr 21 19:50:16 UTC 2003
>It is fairly simple to recover missing elements if that becomes important (essentially by enumerating classes and classifying them as, eg, 'Unclassified' if they are not found in the SystemOrganization. If anyone is feeling bored out there, it would be useful to write a method that verifies consistency of the SO in this manner, and offers to perform this recovery if necessary.
The following method performs the kind of verification and repair I have in mind, with sample invocation in quotes. Someone with discipline might want to remove the halt and cast this into the form of a proper unit test.
Derek: You might want to file this in and see if the first test runs without a halt in your system.
'From Squeak3.4 of 1 March 2003 [latest update: #5170] on 21 April 2003 at 12:35:15 pm'!
!ClassOrganizer methodsFor: 'private' stamp: 'di 4/21/2003 12:31'!
"SystemOrganization verifyElements: (Smalltalk allClasses collect: [:c | c name])."
"Smalltalk allClassesDo: [:c | c organization verifyElements: c selectors]."
| elements |
elements _ elems asSet.
self elementArray asSet = elements ifFalse:
(self elementArray copyWithoutAll: elements) do:
[:excess | self removeElement: excess].
(elements copyWithoutAll: self elementArray) do:
[:missing | self classify: missing under: self class default]].
More information about the Squeak-dev