links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Workspace shared variables
Last updated at 1:57 pm UTC on 7 January 2022

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.  
 => 7        
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
 => nil
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.