Instantiating objects in Geysr

<-Previous | ^UP^ | Next->

As a companion to the REPL interaction described on the previous slide, you can use the built-in Geysr object browser.

Geysr is particularly helpful when working with geometry, as it includes a viewport for rendering the geometry.

Assuming the Gendl web server is running on port 9000, Geysr may be accessed at http://localhost:9000/geysr.

When Geysr is opened, a splash screen is displayed:

To instantiate a compiled object, select:

File..New, and in the text field enter the desired package name and the object type name separated by ::

For the example code in the Resources section, this will be gdl-user::my-box-1.

Press Enter to instantiate the object.

The object will be instantiated, and all of its available slots will be displayed in the Inspector pane in the lower Left-hand section of the browser window.

Note that most slots will initially be shown as unbound.

Clicking on the unbound link will cause the value of the associated slot to be evaluated. In the lower screenshot the slot length has been evaluated and returns 4.

To draw the geometry: first click or tap

Mode and ensure Add Leaves is selected with a checkmark

Then left mouse click or tap on the object name just below the menu bar (in this case GDL-USER::MY-BOX-1), and the geometry will be displayed in the main viewport

The geometry camera view may be changed by selecting View..Perspective and picking any of the pre-defined orientations such a top or left.

The geometry viewport may be cleared by selecting View..Clear!

By selecting Mode..Set Self... then clicking on any object in the tree pane at upper-left, the toplevel value of self will be set to that object, to similar effect as typing (setq self (make-object 'my-box-1)) at the REPL. You may then evaluate any slot in my-box-1 at the REPL

Self is now set to to #<MY-BOX-1 #x210500D41D>, you may use command-line interaction.... - - [Thu, 02 Jun 2022 09:00:48 GMT] "POST /gdlAjax HTTP/1.1" 200 222

GDL-USER> (the)

#<MY-BOX-1 #x210500D41D>

GDL-USER> (the length)


GDL-USER> (the height)


GDL-USER> (the width)


GDL-USER> (the volume)


Creating Fresh Instances

Note: File..New is currently only supported for a Fresh Web Browser Tab.

It is not currently supported to make a fresh instance in an existing Geysr browser tab or window.

So, if you'd like to make a new, fresh instance (of the same or a different type),

then follow these steps:

  1. Open a new Web Browser tab or window.

  2. Visit the toplevel Geysr url.

  3. Click or tap File..New and proceed as in the File..New section above.

Updating Existing Instances after a Code Change

If you want to see the results of a change you've made to the code and loaded into the running session (don't worry, you will learn how compile & load code changes later), then select the Update mode (click or tap Mode..Update...), and finally click in the tree on the object for which you would like to unload any cached results it may be holding, and let the system recompute fresh everything based on your latest code (typically the node you click to Update will simply be the root object in the tree).

This recomputation forms one of the steps of a five-step iterative

process you'll typically follow when developing using Geysr:

  1. Author your desired code (new code or changes to existing code).

  2. Compile the code and load it into the running session (compiling is optional but recommended).

  3. Update the instance in the running Geysr session to reflect the new code.

  4. Inspect and poke around with the results in the various panes of Geysr

  5. Based on said results, return to Step 1 above and repeat.

Your typical development session will include many iterations of the

above five steps. Depending on the situation at hand it is possible to

complete a single iteration very quickly, sometimes in less than one

minute. This rapid iteration potential is one of the upsides of

becoming proficient with GendL combined with Geysr.

A Note on Symbol Names

Note that object type names in Gendl (as in Common Lisp) have two parts:

  1. a Package name

  2. a Symbol name

These can be written together separated by a double colon (::).

For example, the symbol naming our my-box-1 definition was introduced into the system while the gdl-user package was active, or "current" — therefore you can refer to this definition with the fully qualified symbol name: gdl-user::my-box-1

Sometimes it is possible to use a single colon (:) rather than a

double colon (::), and often it is possible to omit the package name

entirely when referring to a symbol.

That's enough on Packages and Symbols for now. You will learn more about Packages and Symbols later.