[Pharo-project] 1.2: class var #Instance not allowed

Janko Mivšek janko.mivsek at eranova.si
Wed Feb 2 17:45:27 CET 2011


On 02. 02. 2011 17:02, Marcus Denker wrote:

>>> One more problem: if some class have a class variable named #Instance,
>>> it is not loadable anymore.

>> The bug is not in the #bindingOf:
>>
>> it just answers (correctly) that for given name there are already a
>> binding exists in system.
>> So, it should be allowed to declare the class variable with same name.
>> But there are some nuances:
>> - what to do if supeclass also defining binding for this name?
>> - what if pool dicitonary in (super)class defines binding for given name?
>>
>> should we allow shadowing of these cases as well, or just for globals?

> The question is: was this allowed before in 1.1? 

It seems yes. I just loaded the same Aida into the latest 1.2 build to
test if everything is ok.

This is BTW also the fastest way to replay this problem. Just open the
Dev workspace and load Aida by a script there.

You'll get the next exception:

      DuplicatedVariableError: Instance is defined elsewhere

AIDASite(Class)>>declare:varString

       ...
	"check if new vars defined elsewhere"
	(self bindingOf: var) notNil
		ifTrue:
 		   [(DuplicatedVariableError new) variable: var;
			signal: var , ' is defined elsewhere'.
		   conflicts := true]].
       ....

Janko

-- 
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si




More information about the Pharo-project mailing list