[Larceny-users] R6RS in Larceny

William D Clinger will at ccs.neu.edu
Fri Feb 16 20:36:45 EST 2007


Concerning van Tonder's implementation of libraries
and syntax-case, Ray Racine wrote:

> Changes were (as best I can recall while watching 24):
>         - Parameterize changes.
>         - define-struct to explicit larceny records
>         - misc
>         - for some reason the scoping is not working
> (let () <internal defines> ...
> body)
>
> I changed it to (begin () ...)

That last bit is fragile.  The problem is that van
Tonder's code depends on left-to-right evaluation of
internal definitions, even though it was supposed to
be R5RS-compatible.  The only reason I can figure
that changing (let ...) to (begin ...) happens to
work is that Twobit's optimizer puts procedure and
constant definitions ahead of other definitions, and
the Larceny sort routine that Twobit uses to do this
performs a stable sort that preserves the order of
the other definitions.

When I ported van Tonder's code, I solved the problem
by redefining the let macro.  That's more robust.  In
the long term, the R6RS will require left-to-right
evaluation of internal definitions, but programmers
still shouldn't rely on that because the run-time
checking that the R6RS is likely to require will
make the compiled code slower or bigger.  The fact
that van Tonder has written code like that shows how
little even experienced Scheme programmers understand
about this source of inefficiency.

Will



More information about the Larceny-users mailing list