help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] Behaviour>>addInstVarName: causes error


From: Bonzini
Subject: Re: [Help-smalltalk] Behaviour>>addInstVarName: causes error
Date: Tue, 29 Apr 2003 16:37:56 +0200

> (I'd post fuller call stacks, but there isn't an easy way to cut&paste
> them as yet :) ).

Patches are welcome :-)

> Now, addInstVarName: and removeInstVarName: actually update
> instanceVariables themselves, but Metaclass>>instanceVariableNames: does
> not. It seems to me that the solution is for addInstVarName: and
> removeInstVarName: to also delegate the update, however, my simplistic
> efforts to make this change don't work very well (possibly I need to
> test them with a change that doesn't destroy the browser if it doesn't
> work :) ).

Or not test them under the browser... in these cases it comes handy not to have 
one.
Anyway here's a patch; there's more meat as there was also a latent bug in the 
code
that actually mutates the instances, and I took the opportunity to validate the 
symbol
passed to #addInstVarName: and to fix the recompilation of subclasses when 
variables
are either removed, or added to a superclass.

The placement of the recompilations was fine because the instanceVariables 
array had
already been modified and hence the compiler already gave errors when the 
removed
variable was found.  With the bugfix, however, they must be moved indeed.

Tell me how these looks like to you and if it works; for the next version I 
cooked up a
testcase and it seems to give good behavior also when a subclass redefines a 
variable
with the same name as a variable in a superclass.

Paolo


Paolo

Attachment: fix-class-mutation.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]