Help - Environment - Workspaces - 1
Workspaces - Next
1. Using Workspaces and Transcripts
You can get a Workspace by:
- Cmd-k in a World
- the Toolsflap
You can have many workspaces open on the screen and switch between them by putting the cursor on the one you want to activate.
Workspaces in Squeak can be used for three main purposes, of which the last two are related
First, one can use a Workspace as an editor of textfiles, and as such there are quite a few commands one can use, most of which are peculiar to Smalltalk and Squeak.
Utilities openCommandKeyHelp. "Select and Cmd-d pops them up. Also in Worldmenu-help."
It should be noted that Workspaces are reasonably good but reasonably simple texteditors. You can easily write texts in them, but if you want to do any serious writing a better texteditor will make it easier to write. You can paste the result in a Workspace and continue, for a Workspace is especially useful in Evaluating Expressions.
Second, inside a Workspace one can write Expressions in the Squeak Language and evaluate these. This can happen in three basic ways:
1. Select the Expression by highlighting it and do Cmd-p for printit and
2. Cmd-i for inspect it.
In any case the Expression is evaluated by Squeak and the result is displayed inside the Workspace immediately after the highlighted Expression (Cmd-p) or the value is displayed in an Inspector window (Cmd-i).
Evaluating is done in a Workspace by selection a part of the text that forms a valid SqL-Expression by highlighting (using Shift, Ctrl and arrow-keys or using the mouse) and do Cmd-p or Cmd-i on it. Here is a simple example to try. Select the expresion on the next line and do Cmd-p. Simple way:
Try Cmd-p with - and when the cursor is on the beginning or end of a paragraph Cmd-Space selects it
This results in "7". Truly! Even if you don't believe so, if you've tried out the above you've seen and performed a minor miracle - of a rational computable kind. (Leibniz would have been in quiet ecstasy, had he seen this.)
Techniques with Evakuating in a Workspace (and in Scamper) with Cmd-p:
- Doing Backspace deletes it if one wants while Cmd-z reverses the action very conveniently (and Cmd-p then repeats it).
- Also, you can do Cmd-c on the result and then Backspace, with the result that if you place the cursor anywhere else and do Cmd-v it prints the result.
Get a Transcript from the Toolsflap, or put the cursor in an empty place in the Project and do Cmd-t. Having done so: Try Cmd-d with the following lines:
| calc expr |
calc := 3+4. "Or anything else you want to calculate in Squeak, such as (2 sin) ln or whatever."
expr := 'This difficult calculation works out as: '. "Telling the user what happens."
Transcript clear; show: expr; cr; show: calc. "Showing the result in the Transcript."
More of this below.
Evaluating and using Transcripts make Workspaces an amazingly versatile editor to do science and much else with, because in fact one can use a considerable amount of Squeak's powers about numbers and strings inside a Workspace or Transcript. (All you need is some familiarity with the code Squeak runs.)
There is much more to both Smalltalk and Squeak, but EvaluatingExpressions in Workspaces or Transcripts itself shows programming in Squeak (or in pure Smalltalk 80 in an MVC-project in Squeak) albeit of the simplest kind.
So here we have to start talking about programming in Smalltalk and Squeak.
Workspaces - Next