Previous: , Up: Condition Instances   [Contents][Index]


16.5.3 Simple Operations on Condition Instances

The simple procedures described in this section are built on top of the more detailed abstraction of condition objects described above. While these procedures are sometimes easier to use, they are often less efficient.

procedure: make-condition condition-type continuation restarts field-plist

Create a new condition object as an instance of condition-type, associated with continuation. The continuation is provided for inspection purposes only, not for restarting the computation. The restarts argument is described in Restarts. The field-plist is an alternating list of field names and values for those fields, where the field names are those that would be returned by (condition-type/field-names condition-type). It is used to provide values for fields in the condition object; fields with no value specified are set to #f. Once a condition object has been created there is no way to alter the values of these fields.

procedure: access-condition condition field-name

Returns the value stored in the field field-name within condition. Field-name must be one of the names returned by (condition-type/field-names (condition/type condition)). access-condition looks up the field-name at runtime, so it is more efficient to use condition-accessor to create an access function if the same field is to be extracted from several instances of the same condition type.

procedure: condition/report-string condition

Returns a string containing a report of the condition. This is generated by calling write-condition-report on condition and a string output port, and returning the output collected by the port as a string.


Previous: Condition Abstraction, Up: Condition Instances   [Contents][Index]