Miscellaneous Envision Functions


Envision extends scheme in several minor miscellaneous ways.

Multiple values

We require the capability to return multiple values from a function. Specifically, we assume the functions values, call-with-values, and receive provided in scheme48. We then provide two new functions for catching returned values:

The functions receive, multiple-set!, and multiple-define are much more convenient for the user than call-with-values and fit within the limited capabilities of the sub-language used to write user-defined coprocessor functions.


The function expect should be called when the user expects some boolean condition to be true. For example, the user might believe that a particular input to the function is never missing, because the calling function has already checked this. This information is very important, because the compiler can use it to eliminate checks for missing values.

Expect takes one input, a boolean expression. If the expression returns true, it returns an unspecified value. If it is false, an error break is triggered.

Expect forms are useful for two reasons. First, they can be used by the programmer to trigger error breaks on inputs which would cause problems for later parts of the algorithm, thereby guarding the later parts of the code from some disaster (e.g. an infinite loop). Second, the compiler may use the information contained in expect forms to optimize later parts of the code. In particular, an expect form outside a scan loop may be used to suppress repeated checks of the same condition within the loop.

Currently, no optimizations are done. Soon, we hope that the compiler will understand expressions which are conjunctions of assertions that certain variables do not contain missing values. It will suspend missing checks until the variables have been, or might have be, reset to a value which might be missing.

Expect forms are intended only for documenting constraints and catching unexpected failures of these constraints. Problems that are anticipated should be handle by other means. For example, code might be modified to return a missing value. Or the problem might be caught by a shell function running in scheme protecting a user-defined coprocessor function from bad inputs. Exit from the middle of loops should be accomplished using the tests associated with the loops.


Ownership, Maintenance and Disclaimers

Manual Top Page

Last modified