[ENH] DeclareInstVar (test case)

Lex Spoon lex at cc.gatech.edu
Wed Jul 16 17:35:00 UTC 2003


Lukas Renggli <renggli at hotmail.com> wrote:
> > However, it seems to compile the variable incorrectly.  It declares an
> > instance variable, but it compiles it as a temporary variable.  Here's
> > the relevant code:
> >  [...snip...]

> That is true, I was quite unsure about this part of the code and I did 
> not have a closer look at the parsing stuff yet. But when decompiling to 
> byte-code I agree that you are right:
>  [...snip...]
> However from the user point of view there seems to be no difference and 
> both work perfectly in my 3.5 image.


It doesn't work the same in all cases.  Here's a specific test case:

	1. Create a class named Frob.
	2. Create a method 'a ^a', and choose to declare an instance variable.
	3. Inspect "Frob new".
	4. Set the "a" variable to 42 within the inspector.
	5. Type "self a", and observe that it returns nil instead of 42.
	6. Recompile the 'a' method (add a space and then accept).	
	7.  Now "self a" in the inspector will return 42.

This in Squeak 3.6, but it probably doesn't make a difference.  The code
is quite clearly make it a temporary variable instead of an instance
variable on the first compile.


Lex



More information about the Squeak-dev mailing list