Go to the first, previous, next, last section, table of contents.


withRestartDo

Control-struct: ]withRestartDo{ ... }
file: job.t
package: muf
status: alpha

The ]withRestartDo{...} operator is the current Muq MUF surface syntax for executing code under the control of a specified restart. (See section Restarts.)

The MUF syntax for establishing a restart is

[ :name 'halt-and-catch-fire
  :function  :: halt-and-catch-fire ;
  :testFunction nil
  :interactiveFunction nil
  :reportFunction "Halt and catch fire"
  :data "<any user data value whatever>"
| ]withRestartDo{
  ...
}

where nil properties may be omitted.

The :reportFunction may be either a string, or else a function accepting a stream and printing a string to that stream.

Restarts intended for interactive use should have a :reportFunction (which may be merely a string). If :function takes no arguments, then :interactiveFunction may be nil, otherwise :function should accept a single block of arguments, and :interactiveFunction should be a function which generates an appropriate argument block, typically by use of the queryFor* functions (see section user i/o functions).

Note: The :function value needs to be of arity { -> } if the restart is to be invoked via invokeRestart, and of arity { [] -> } if the restart is to be invoked via ]invokeRestart. In particular, this means that restart :functions exiting via a nonlocal goto will usually need to be forced to the appropriate arity. Example:

withTag my-tag do{
    [   :function :: { -> ! } 'my-tag goto ;
        :name 'my-restart
    | ]withRestartDo{
        ...
    }
}

See section Muq Events for a general discussion of the event system.

The :data value is a hook intended to be used by user code to attach any desired information to a restart: It may later be used by user-defined handlers when selecting a restart to invoke. It is ignored by all software in the current standard Muq distribution.


Go to the first, previous, next, last section, table of contents.