[ENH] DeclareInstVar (declares fine, but compiles as a temp var)

Lex Spoon lex at cc.gatech.edu
Wed Jul 16 01:14:20 UTC 2003


renggli at student.unibe.ch wrote:
> 
> --==CelesteAttachment62531==
> 
> from preamble:
> 
> "Change Set:		DeclareInstVar
> Date:			15 July 2003
> Author:			Lukas Renggli
> 
> Adds the menu-item 'declare instance variable' to the list that is
> displayed when the parser encounters an undeclared variable. The
> generation of the menu has been slightly altered to allow other
> extensions more easily."!

This has been on my wishlist for a long time!  Awesome!

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:

!Parser methodsFor: 'error correction' stamp: 'lr 7/15/2003 20:06'!
declareInstVar: name
	encoder classEncoding addInstVarName: name.
	^encoder bindArg: name! !


A quick test verifies the problem.

What should probably happen is the same thing that
init:context:notifying: does to initialize instance variable.  This, in
turn, sounds like a good method to extract.  It would be
#declareInstanceVariableNamed:atIndex: .

I hope this eventually works -- it will really help with exploratory
programming!

Lex



More information about the Squeak-dev mailing list