>>> >>> 2017-07-12 9:09 GMT+02:00 Marcus Denker <marcus.den...@inria.fr >>> <mailto:marcus.den...@inria.fr>>: >>> in the workspace it creates a variable (with value nil)… so it treats >>> upper-case >>> unknown vars the same as lower case. >>> >>> I think it might make sense to have for upper case instead the menu that >>> asks >>> what to do (it could there have a “add binding to workspace” entry for the >>> current >>> way, too) >>> >>> I would prefer same behaviour like in method editor. I really hate when I >>> made mistake in class name and after evaluation I got uppercase binding >>> with nil value. >> >> yes, we should fix it. binding should just be created for lower case vars. >> > > How to fix it: > > OCRequestorScope is the scope of variables in tools. #lookupVar: is the > method that is doing the lookup. > > replace the code > > global := self lookupGlobalVar: name. > global ifNotNil: [ ^ global ]. > > with: > > name first isUppercase ifTrue: [ ^ outerScope lookupVar: name]. > > But: right now we abuse the requesterscope to implement the feature that you > can hand > in an additional dictionary with bindings. See > testEvaluateWithBindingsWithUppercaseName > This change breaks this feature… but it just means we need to implement this > better, which > I will do . > For Pharo6:
https://pharo.fogbugz.com/f/cases/20254/Playground-should-ask-to-create-class-for-non-Existing-Globals <https://pharo.fogbugz.com/f/cases/20254/Playground-should-ask-to-create-class-for-non-Existing-Globals> This adds a scope for additional bindings and uses this for the bindings, which then allows us to change the requestorscope as needed. Marcus