[squeak-dev] Re: SystemEditor
Matthew Fulmer
tapplek at gmail.com
Sun Nov 30 03:26:24 UTC 2008
On Wed, Nov 26, 2008 at 07:45:14PM -0800, Andreas Raab wrote:
> Secondly, the issue I was seeing with the iVars being incorrect are one
> of the subtleties that SE currently doesn't correctly deal with. Here is
> an illustration:
>
> testCleanupOfOldInstances
> "Ensure that old instance are cleaned up properly"
> instance := CleanupTestClass new.
> Smalltalk garbageCollect. "for easier results make it old"
>
> self assert: CleanupTestClass instanceCount = 1.
>
> ed := SystemEditor new.
> (ed at: #CleanupTestClass) addInstVarName: #whatever.
> ed commit.
>
> self assert: CleanupTestClass instanceCount = 1.
>
> ed := SystemEditor new.
> (ed at: #CleanupTestClass) removeInstVarName: #whatever.
> ed commit.
>
> self assert: CleanupTestClass instanceCount = 1.
>
> The problem is that since #become: changes class pointers you *must*
> clean out the old instances or otherwise they'll be completely and
> utterly broken when you finally #become: the classes itself. This can be
> achieved by placing a strategic full GC in the right place in the
> migration process (I'm not sure where that would be in SE but probably
> somewhere in the migration transaction).
You are right. There is no equivalant to the garbageCollect in
ClassBuilder >> migrate:to:. The best place to put it would
probably be at the end of SystemEditor>>commit
--
Matthew Fulmer -- http://mtfulmer.wordpress.com/
More information about the Squeak-dev
mailing list
|