Would be nice to have a view on them like in VW. On Saturday, December 14, 2013, Marcus Denker wrote:
On 14 Dec 2013, at 16:15, Norbert Hartl <norbert@hartl.name<javascript:_e({}, 'cvml', 'norbert@hartl.name');>> wrote:
Am 14.12.2013 um 15:58 schrieb kilon alios <kilon.alios@gmail.com<javascript:_e({}, 'cvml', 'kilon.alios@gmail.com');>
:
yes sorry i meant global variables , the ones you define in workspace like a := 1.
Those arenât globals. Everything you do in the workspace is compiled as method (UndefinedObect>>#DoIt) and executed. There are only a handful of global values and there is the smalltalk dictionary where names can be looked up.
They live in the âbindingsâ ivar of Workspace.
When you compile code with the ârequestorâ not nil, it will put a OCRequestorScope into the scope chain. This means that when Opal Semantic analysis asks the scope for the definition of a name, it will call #lookupVar: on that scope, which is then doing:
(requestor bindingOf: name asSymbol) ifNotNil: [:assoc | ^ OCLiteralVariable new assoc: assoc; scope: self; yourself]. ^ super lookupVar: name.
Which means that variables in the Workspace are compiled as literal variables (like globals), but the binding comes from a dictionary that is in the ivar âbindingsâ of the Workspace.
Marcus
-- --- Philippe Back Dramatic Performance Improvements Mob: +32(0) 478 650 140 | Fax: +32 (0) 70 408 027 Mail:phil@highoctane.be | Web: http://philippeback.eu Blog: http://philippeback.be | Twitter: @philippeback Youtube: http://www.youtube.com/user/philippeback/videos High Octane SPRL rue cour Boisacq 101 | 1301 Bierges | Belgium Pharo Consortium Member - http://consortium.pharo.org/ Featured on the Software Process and Measurement Cast - http://spamcast.libsyn.com Sparx Systems Enterprise Architect and Ability Engineering EADocX Value Added Reseller