demoSourceClass: Class "demoSource" for objects used with demoSource()...

Description Objects from the Class Slots See Also

Description

Objects from this class are created and manipulated during interactive sessions with the demoSource() function. They

Objects from the Class

Objects can be created by calls of the form new("demoSource", ...). Generally, objects are created by demoSource() and modified by the various utility functions that process control and demo input. Objects from the class are normally used to save and restart an incomplete demo.

Slots

lines:

Object of class "character" holding the lines of the source connection.

pos:

Current position in the source buffer (the number of lines that have been processed so far).

partial:

While an expression is being parsed, lines in the current expression are copied here.

expr:

When an expression has been parsed, the parsed expression is stored here.

value:

When an expression has been evaluated, the value is stored here.

envir:

Object of class "environment", the environment in which expressions have been evaluated.

state:

Character string used to indicate the current state of the demo. States "partial", "parsed", and "evaluated" correspond having read some (or all) of the current input, to having parsed that (and determined that it's a complete expression), and having evaluated the expression.

See demoSource() for how one gets to these states; for example, the typical "" control input first reads and parses to a complete expression, and then on the next such input evaluates.

The various utility functions used by demoSource() modify the demo object they receive to reflect the step(s) taken, and then return the modified object. The call to demoSource() itself returns (invisibly) the demo object as it stands when the demo exits. Using the returned object, one can pause and resume a demo or interleave multiple demos.

See Also

demoSource()


SoDA documentation built on Oct. 28, 2020, 9:07 a.m.