[up] [next]

Getting Started

Saving a Snapshot Image

At any time during your work, you can always save the current state of the system in a so-called "snapshot image file", from which the system can recover at a later time.
So, if during your excursion through the system, you are getting thirsty and you need a break, simply leave the system and confirm the saving when asked.

When you later restart smalltalk, it will return to exactly the point where you left off before (try it !).

It is also a good idea to create a snapshot before you try out something dangerous - such as modifying a base system class. To save a snapshot, click on the save button in the launcher windows toolbar.

However, don't panic:
you cannot really destroy or do permanent harm to your ST/X system in the browser - the worst that can happen is that your last few changes are lost and you have to restart the system in fresh state (i.e. without a snapshot).
From this, you can incrementally reapply your changes in the ChangeBrowser.

The way this is done is described below, in "Recovering from a Crash".

Opening a Workspace

Before starting your first excursion into the smalltalk language, you should first learn how to open a workspace window and how to leave the debugger in case you run into an error (which is quite likely -).

A workspace window is NOT used for programming. Instead, it is a scratchpad window into which some code can be typed for demonstration, to try things and as a scratchpad (as an editor, to keep code snipplets around).

A workspace allows you to enter smalltalk code and execute it. This is also refered to as "immediate execution", since you can typeIn some piece of code and immediately evaluate it. There is no need for a main-program or a slow compile/link/execute cycle.

For a new workspace, select the [-->]workspace item in the Launchers [-->]tools menu.

[Workspace-menu-screenshot]

The above action opens a view which looks similar to:

[Workspace-screenshot-1]

You can use workspaces as text scratchpads, as copyBuffers or to evaluate Smalltalk expressions (which is their main use).

Expression Evaluation

Expression evaluation is called "doIt evaluation", or "doIt" for short.

Also, you can evaluate some smalltalk code and have the result printed into the workspace. This operation is called "printIt". In the following, we will refer to both actions as doIt.

DoIts are perfect to try out something quickly; you can evaluate expressions to send messages, without a need to write a program which remains permanently in the system (and has to be removed later).
They can also be used to for all kinds of computations (such as math), or as a scripting language - i.e. for the kind of work other less lucky programmers have to use batch, shell or even tcl scripts for (uh - ugly). Some examples of useful scripts are found in "Useful Scripts for Workspaces".

To execute some smalltalk code, type it into the workspace:

[Workspace-screenshot-2]

select it (using the mouse):

[Workspace-screenshot-3]

and evaluate it with the workspaces middle-button [-->]printIt menu function:

[Workspace-screenshot-4]

the result is displayed in the workspace:

[Workspace-screenshot-5]

There are also keyboard accelerators for the most common operations;
"doIt" is usually bound to "Alt-d" and "printIt" to "Alt-p".
(If these do not seem to work, try the "Ctrl"-key instead of "Alt" )

Finally, a selection is quickly made by pressing the "ESC" key, which selects the current lines text from the beginning to the current textcursor position. (i.e. a printIt operation can also be done with two keys: "ESC" followed by "printIt")

In addition (because we are lazy), doIt-evaluations are also possible without any selection at all; in this case, the current cursor line is taken and evaluated.
(i.e. a printIt operation can be done with a single "printIt" key, as long as the cursor is in the line to be evaluated).

A list of accelerators is found in "Getting started - Keyboard accelerators".

Like on a piece of paper, you can click-and-type anywhere within the workspace (i.e. you are not forced to type into the last line or right after a line-end).
Also, any text in the workspace can be selected for doIt evaluation (i.e. you can reselect any previous expression and do not have to retype any text).

Try a few expressions; such as:
(dont care for the smalltalk syntax - the meaning will be explained later)

    1 + 2
    2 sqrt
    Transcript showCR:'hello world'
    Transcript showCR:(2 sqrt)
    (Button label:'hello') open
    WorkspaceApplication open

Evaluation Workspace

For beginners (and to try and explore more smalltalk expressions), the new workspace application provides a special 3-pane evaluation workspace which provides convenient buttons for evaluation, displays the set of workspace variables, a separate result view, and also keeps a list of recent evaluation results.
This is opened via the "New Evaluation Workspace" or "Add Evaluation Page" menu items of the workspace application.

Leaving the Debugger

Whenever an error is encountered, smalltalk opens a debug window, which displays the state of execution and a walkback list (this shows how you got to the point where the error was detected).
During this introduction, as a beginner, you should probably not care too much for all the information as displayed; instead simply abort whatever operation you started. (we will learn more about the debugger later.)

So, if you get into the debugger while evaluating the following examples, simply press the debuggers abort button (or simply close it) and retry whatever you did (but look for any typing errors - otherwise you may get another debugger)

Do NOT fear the debugger - as opposed to whatever programming experience you might have, the Smalltalk debugger is your best friend and the better programmers actually write most of their program in the debugger !

To get used to the debugger, try the following example (which contains an error by purpose) in a workspace. (if tried from within the document viewer, a confirmation dialog will be shown before the debugger window is actually opened):

    1 / (1 min:0)
In the debugger, press the "abort"-button to leave the erronous execution.
For more information on what is shown in the debugger and how to use it, read "Using the Debugger".


Continue in "Smalltalk basics".


[stx-logo]
Copyright © Claus Gittinger Development & Consulting
Copyright © eXept Software AG

<cg@exept.de>

Doc $Revision: 1.17 $ $Date: 1999/08/10 13:05:26 $