[plt-scheme] unexpected behavior of top level continiuations

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Sep 12 13:22:41 EDT 2004

At Sat, 11 Sep 2004 14:33:10 -0500, Corey Sweeney wrote:
> In fact R5RS does not require a working scheme
> implemenation to be compliant. So I'm forced to wonder, why were
> continuations implemented this way in Drscheme

The semantics of `load' or `read-eval-print-loop' in DrScheme is
`read', then `eval', then `print', then `read', etc.

In your first example, the "this was not in the continiuation" part was
still in the port at the time that the continuation was captured (i.e.,
not yet `read'). Capturing the continuation does not capture the state
of the port, so that's why the "this was not in the continiuation" part
wasn't captured by the continuation.

> and why is the top
> level left out of the R5RS?  is it some deep technical reason, or more
> of a apathy issue?

It's difficult to make the top-level work consistently for different
uses of a program, such as interactive evaluation and batch
compilation. This is why we switched to `module', and it's why
DrScheme's various tools don't really try to deal with non-`module'
programs.

Matthew



Posted on the users mailing list.