|
From: Derek U. <Der...@on...> - 2002-09-10 01:17:48
|
The URL
http://www.serv.net/~sand/jscheme-values/
contains a directory of files that implement R5RS "values" and
"call-with-values" in JScheme (based on the CVS tree), replacing the
implementation in the EOPL2 support code. These are the complete files, not
patch files.
The implementation uses the typical hack of creating an object that bundles
all the return values; "call-with-values" knows how to unpack the object.
This makes it possible to run illegal code, e.g.,
(define foo (values 1 2 3))
The implementation handles the weirdnesses and edge cases that I know about:
* "(values X)" returns "X", not a values object
* "(values)" is supported, and can be passed to continuations that take no
arguments.
* It is always legal to pass zero values or more than one value to
continuations that ignore their arguments (such as the continuations of
non-tail expressions inside a "lambda" body).
The printed representation of a "values" object is the representation of all
the child objects, separated by newlines. The REPL adds a newline on the
end, which means that "(values)" displays as a blank line. It may be useful
to tweak the REPL to avoid that as a special case.
Derek
--
Derek Upham
Senior Software Engineer
Ontain
1750 112th Ave NE, Suite C-245
Bellevue, WA 98004-3727
Tel: 425-460-1886
der...@on...
|