Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.1042.mcz ==================== Summary ==================== Name: Kernel-nice.1042 Author: nice Time: 29 September 2016, 10:15:16.009388 am UUID: 8923b113-72cf-414e-802c-cef7c50f8ad1 Ancestors: Kernel-tfel.1041, Kernel-nice.798 Merge Kernel-nice.798 (variable scope fix, don't resolve name in superclass environment) Reminder: this requires some Smalltalk exportSelf. =============== Diff against Kernel-tfel.1041 =============== Item was changed: ----- Method: Class>>bindingOf:environment: (in category 'compiling') ----- bindingOf: varName environment: anEnvironment "Answer the binding of some variable resolved in the scope of the receiver" | aSymbol binding | aSymbol := varName asSymbol. + "First look in local classVar dictionary." + binding := self classPool bindingOf: aSymbol. + binding ifNotNil:[^binding]. - "First look in classVar dictionary." - (self classThatDefinesClassVariable: aSymbol) ifNotNil: - [:x | ^x classPool bindingOf: aSymbol]. + "Next look in local shared pools." - "Next look in shared pools." self sharedPools do:[:pool | binding := pool bindingOf: aSymbol. binding ifNotNil:[^binding]. ]. + "Next look into superclass pools" + superclass ifNotNil: [^ superclass bindingOf: aSymbol environment: anEnvironment]. + + "No more superclass... Last look in declared environment." + ^anEnvironment bindingOf: aSymbol - "Next look in declared environment." - binding := anEnvironment bindingOf: aSymbol. - binding ifNotNil:[^binding]. - "Finally look higher up the superclass chain and fail at the end." - superclass == nil - ifTrue: [^ nil] - ifFalse: [^ superclass bindingOf: aSymbol]. - ! |
This breaks compiling EToys scripts when those refer to global classes. I probably don't understand something here, but for context, EToys players are not in the global environment, they create their own otherwise empty environment. On Thu, 29 Sep 2016 at 10:19 <[hidden email]> wrote: Nicolas Cellier uploaded a new version of Kernel to project The Trunk: |
The behavior before would look up aSymbol in the environment of the superclass. Now we'll have to import it into the environment of the subclass. Is that the desired new behavior? On Fri, 30 Sep 2016 at 11:23 Tim Felgentreff <[hidden email]> wrote:
|
2016-09-30 11:32 GMT+02:00 Tim Felgentreff <[hidden email]>:
Yes please, explicitely import the superclass environment (see #import:).
|
Free forum by Nabble | Edit this page |