[plt-scheme] 352.7

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Oct 13 18:11:46 EDT 2006

MzScheme and MrEd are now version 352.7 in the SVN repository trunk.

The main change is the addition of delimited and composable continuations
(see below).

Other changes:

 * Changed `make-file-or-directory-link' to not expand its first
   argument; instead, the path is written verbatim as a link.

 * Changed `make-security-guard' to accept an optional guard procedure
   to control links. The default disallows the creation of links via

 * Removed `write-image-to-file' and `read-image-from-file', finally.

 * Changed `call/ec' so that its argument is no longer applied in tail
   position. This reverses a change introduced in v350, and it makes
   "escape continuations" more like prompts than continuations.

 * Mac OS X event handling is different internally, but hopefully
   behaves the same (or slightly better).


Delimited continuations

If you're not familiar with delimited continuations, I recommend
starting with

 "Control Delimiters and Their Hierarchies"
 Sitaram and Felleisen
 Lisp and Symbolic Computation, 1990
 (available from http://www.ccs.neu.edu/scheme/pubs/ )

MzScheme's support for prompts and composable continuations most
closely resembles Dorai Sitiram's tagged `%' and `fcontrol' operators;
see "Handling Control", PLDI'93, or see Dorai's dissertation.

The key feature of Dorai's `%' is that it accepts a procedure to handle
continuation escape to the prompt. A programmer who installs a prompt
can thus choose whether the prompt can be removed. At the same time,
having `call/cc' means that callees can choose whether to keep the
prompt, if removing it is an option. Consequently, the "control.ss"
library in MzLib offers `prompt', `control', `shift', `prompt0' (a.k.a.
`set'), `control0' (a.k.a. `cupto'), etc. operators that all work
together in a reasonable and useful way.

MzScheme's composable continuations capture and invoke `dynamic-wind'
thunks. To give programmers more flexibility with respect to escapes
when using composable continuations, the `fcontrol' operator is
actually split into separate capture and abort operations. Meanwhile,
`call/cc' essentially belongs to the `dynamic-wind' subsystem, since it
provides a way to run a subset of the `dynamic-wind' thunks since the
shared (if any) prompt between the current and captured continuations.

Composable continuations also capture continuation marks, which
provides a dynamic binding mechanism analogous to that of Kiselyov,
Shan, and Sabry (ICFP'06).

Summary of the relevant procedures in MzScheme:

 Basic control:

  call-with-continuation-prompt     : `%'
  call-with-composable-continuation \
  abort-current-continuation        / together, `fcontrol'

  make-continuation-prompt-tag : new type for prompt tags (instead
                                 of just using symbols)
  default-continuation-prompt-tag : default tag (used, e.g., by `call/cc'
                                    when no specific tag is supplied)

 Dynamic wind:

  call/cc               : accepts an optional prompt tag

 Continuation marks:

  continuation-marks    : accepts an optional prompt tag

Use `(lib "control.ss")' for more readable traditional forms, such as
`prompt', `control', `shift', and `reset'.

For now, parameters do not work well with composable continuations,
because all parameter settings are grouped into a "parameterization"
(that is attached to a continuation through a single continuation
mark). In other words, there's no such thing as a delimited
parameterization. This mismatch is hopefully temporary.

Posted on the users mailing list.