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 <[hidden email]>:
> 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? > > 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. |
In reply to this post by Janko Mivšek
On Feb 2, 2011, at 2:32 PM, Igor Stasenko wrote: > 2011/2/2 Janko Mivšek <[hidden email]>: >> 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? > The question is: was this allowed before in 1.1? Marcus -- Marcus Denker -- http://www.marcusdenker.de INRIA Lille -- Nord Europe. Team RMoD. |
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 |
Administrator
|
Could you be more specific as to the steps to reproduce? I added a class var named Instance to a class, filed it out, removed the class, and filed it back in with no error. Also, it seems the error is resumable, so won't the class be loaded if you "proceed" on the error? Sean
Cheers,
Sean |
On 03. 02. 2011 04:27, Sean P. DeNigris wrote:
> Janko Mivšek wrote: >>>>> One more problem: if some class have a class variable named #Instance, >>>>> it is not loadable anymore. > Could you be more specific as to the steps to reproduce? I added a class var > named Instance to a class, filed it out, removed the class, and filed it > back in with no error. Also, it seems the error is resumable, so won't the > class be loaded if you "proceed" on the error? Proceeding on this exception actually continue and successfully load Aida. As said you can reproduce the problem by loading Aida on latest 1.2 build: 1. DEVImageWorkspaces openExternalProjectWorkspace 2. evaluate the Aida loading script there: Gofer new squeaksource: 'MetacelloRepository'; package: 'ConfigurationOfAida'; load. (Smalltalk at: #ConfigurationOfAida) load. Best regards Janko -- Janko Mivšek AIDA/Web Smalltalk Web Application Server http://www.aidaweb.si |
Administrator
|
>>>>> One more problem: if some class have a class variable named #Instance,
>>>>> it is not loadable anymore. So the class can be loaded, and that solves the original problem, right? The current behavior seemed right to me. I think it's good to know that you will be hiding a global by using a certain class variable name. Maybe the issue is that the message isn't clear enough, like it could be "There is global defined with this name, click proceed to add anyway"? Or something to make it more clear that this is a warning and you have to make your own decision. Sean
Cheers,
Sean |
In reply to this post by Janko Mivšek
On Feb 3, 2011, at 6:01 PM, Sean P. DeNigris wrote: > >>>>>> One more problem: if some class have a class variable named #Instance, >>>>>> it is not loadable anymore. > > > Janko Mivšek wrote: >> >> Proceeding on this exception actually continue and successfully load Aida. >> > > So the class can be loaded, and that solves the original problem, right? > > The current behavior seemed right to me. I think it's good to know that you > will be hiding a global by using a certain class variable name. Maybe the > issue is that the message isn't clear enough, like it could be "There is > global defined with this name, click proceed to add anyway"? Or something to > make it more clear that this is a warning and you have to make your own > decision. Hmm... normally these warnings should be suppressed when loading code automatically in non-interactive mode (that is, monticello loads code vs. accepting in the browser). In the browser, we want lots of warnings. When we compile code, we just want Transcript notifications. Marcus -- Marcus Denker -- http://www.marcusdenker.de INRIA Lille -- Nord Europe. Team RMoD. |
Free forum by Nabble | Edit this page |