Last updated at 10:21 pm UTC on 9 December 2017
A window used as a scratchpad area where fragments of Smalltalk code can be entered, stored, edited, and evaluated. (Inside Smalltalk, vol I, p. 71)
In Pharo the workspace is called "Playground". A workspace is a place to quickly try out code snippets which later might be copied to instance or class methods.
To open a workspace window in Squeak, one possibility is to bring up the World menu, select "open...", and then select "workspace".
You can then type in any Smalltalk code inside the workspace window and execute it or inspect it.
This is normally done by typing in some code, highlighting it with the mouse, and then selecting "do it" or "print it" or "inspect it" from the pop-up menu. Or "debug it" to open a Debugger on the code. (To bring up a pop-up menu in Squeak, use the "yellow" mouse button, normally the middle or right mouse button, or option-click on a Mac. Or you can use the menu shortcut keys, such as cmd-d, alt-p, etc.)
For example, if you type 3 + 4 in a workspace, highlight it, and select "print it" from the pop-up menu, it will print the result 7. You can type any small or large piece of Smalltalk code...
Try also: Very first steps in a Workspace window.
You can create and use temporary variables local to the workspace. You don't need to declare them like in methods. Variable names starting with a lowercase letter will automatically be created as a local variable (e.g., i := 2). Variable names starting with an uppercase letter will cause a dialog box to question if you want to create a Global variable or pick from similar variables (e.g., I := 2). If you create a Global variable and save your image you will need to delete it explicitly to remove it and free the object represents (e.g., Smalltalk removeKey: #I).
Get a reference to a Morph from within a Workspace
FAQ: How do I access a Morph from a Workspace?
Saving Workspace to a File
Open a Workspace with content
See also the "Code in Text Windows" section of Basic Squeak Development Tools for more info on what you can do in a Workspace or other text windows.
How to set the pane background of a Workspace to a picture
Make your life easier! If you want tab-completion and syntax highlighting, check outShoutandeCompletion.
Note on the implementation of Workspace_
Construct a Workspace window
The model of the SystemWindow is an object of the class Workspace.