[ENH] DeclareInstVar

Lukas Renggli renggli at hotmail.com
Wed Jul 16 18:56:18 UTC 2003


from preamble:

"Change Set:		DeclareInstVar
Date:			16 July 2003
Author:			Lukas Renggli

In <E19cqBN-0006Rl-00 at logrus.dnsalias.net> Lex Spoon wrote:
> 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...]
> 
> [...snip...]
>
> 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.

Thanks for the test-case, I observed exactly the same problem in Squeak
3.5. The attached changeset should solve it.

Lukas"!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DeclareInstVar.cs.gz
Type: application/octet-stream
Size: 1677 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20030716/26807bd5/DeclareInstVar.cs.obj


More information about the Squeak-dev mailing list