[Pharo-project] 1.2: class var #Instance not allowed
Hi guys, One more problem: if some class have a class variable named #Instance, it is not loadable anymore. It seems that problem is in Class>>bindingOf: method, where check is done in a "declared environment", which happens to be a global SystemDictionary, where a class Instance actually exists. This means that no class var with a name which collides with a name of class is allowed? Class>>bindingOf: ... "Next look in declared environment." binding := self environment bindingOf: aSymbol. binding ifNotNil:[^binding]. ... Strack trace follows in next mail -- Janko Mivšek AIDA/Web Smalltalk Web Application Server http://www.aidaweb.si
2011/2/2 Janko Mivšek <janko.mivsek@eranova.si>:
Hi guys,
One more problem: if some class have a class variable named #Instance, it is not loadable anymore.
It seems that problem is in Class>>bindingOf: method, where check is done in a "declared environment", which happens to be a global SystemDictionary, where a class Instance actually exists.
This means that no class var with a name which collides with a name of class is allowed?
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?
Class>>bindingOf:
   ...     "Next look in declared environment."     binding := self environment bindingOf: aSymbol.     binding ifNotNil:[^binding].    ...
Strack trace follows in next mail
-- Janko Mivšek AIDA/Web Smalltalk Web Application Server http://www.aidaweb.si
-- Best regards, Igor Stasenko AKA sig.
participants (2)
-
Igor Stasenko -
Janko Mivšek