Next Previous Up Top Contents Index

10 The Interactive Editor

10.4 Using the editor for interactive development

You will recall from "An example interaction with Reversi" on page 116 that we were able to change the shapes of the Reversi game pieces while the application was running simply by providing new definitions in the interactor. Now imagine that you were developing the Reversi application and wanted to interact with it as you coded the sources. The Functional Developer editor allows you to compile pieces of your code and see the results in the running application by using Project > Compile Selection.

In the following example we interact with the Reversi application from an editor window opened on one of the Reversi sources.

1. Open the Reversi project, and choose Application > Start.
2. Make some moves on the board.
3. Open the file board.dylan in the editor by double-clicking it in the reversi project window.
4. Find the variable definition:
define variable *reversi-piece-shape* = #"circle";

5. Change the word circle to square, so that the line reads:
define variable *reversi-piece-shape* = #"square";

6. Select the line of code and choose Project > Compile Selection.
Notice that the status bar says "Compiling region..." and then "*reversi-piece-shape* successfully downloaded".
7. Make a few moves on the board.
The new moves and any refreshed area of the board display square game pieces.

Unlike the interactor, which compiles and executes the code you enter in the context of the paused thread to which the debugger is connected, the editor compiles the code you select in the context of a special interaction thread that it chooses automatically. This prevents unnecessary tampering with user threads.


Getting Started with Functional Developer - 31 MAR 2000

Next Previous Up Top Contents Index