Workspace shared variables
Last updated at 1:57 pm UTC on 7 January 2022
=== TO BE CHECKED BY AN EXPERIENCED SMALLTALKER ===========
According to the Blue Book Smalltalk has three kind of variables, Private, Shared and Temporary (see pg.21,51). There aren't in Smalltalk parlance global v.s. local variables.
A variable is Private when it is accessible only by one object, Shared when it is accessible by more objects and Temporary when it is defined into a | ... | block.
A programmer who types this into a Workspace
myVar := 3.
4 + myVar.
may think he has defined a "global" variable. In some sense this is is true, this variable is accessible by all statements run in the same workspace.
Try to open another workspace and type
Haha! The variable here is not defined. Se we can't really say it is "global". It could be most properly called "Workspace shared" variable.
Exercise. How do you get the list of all Workspace shared variables? Suggestion. You must send inspectBindings message to the Workspace object.
In the window below a variable called myVar is used.
You may check that it is bound to the workspace if you bring up the HaloMorph (do central mouse click on the object of interest) and you choose the red icon -> 'debug menu' -> inspect morph.