Discussion:
[Larceny-users] bug: export levels of ... from (rnrs)
Derick Eddington
2009-09-16 07:56:46 UTC
Permalink
IIUC, according to R6RS, ... is exported from (rnrs) with levels 0 and
1. This means if ... is used at level 2, then to get ... from (rnrs),
(rnrs) needs to be imported for (meta 1) so that ... is imported at
levels 1 and 2. If this is true, then I believe the below is a bug for
explicit-phasing systems. I tried it using

Larceny v0.97 "Funny in the Head" (Sep 16 2009 00:17:46, precise:Linux:unified)
larceny.heap, built on Wed Sep 16 00:19:27 PDT 2009


(import
(except (rnrs) syntax-rules ...)
(for (only (rnrs) syntax-rules) (meta 1))
(for (only (rnrs) ...) (meta 0 #;-11)))

(define-syntax S0
(let-syntax ((S1 (syntax-rules ()
((_ x ...)
(syntax-rules ()
((_)
(list x ...)))))))
(S1 1 2 3)))

(write (S0)) (newline)


$ larceny --r6rs --program ooo-level.sps
(1 2 3)
$


As you can see, using ... at level 2 worked, even though ... should have
been imported for only levels 0 and 1. It seems that ... is exported
with levels 0, 1, and 2, as the error message shows when instead
importing ... from (rnrs) at (meta -11).
--
: Derick
----------------------------------------------------------------
Derick Eddington
2009-09-16 08:06:57 UTC
Permalink
Post by Derick Eddington
IIUC, according to R6RS, ... is exported from (rnrs) with levels 0 and
1. This means if ... is used at level 2, then to get ... from (rnrs),
(rnrs) needs to be imported for (meta 1) so that ... is imported at
levels 1 and 2.
[...]
BTW, I've found it quite confusing and inconsistent that R6RS exports
some bindings at levels other than 0 so that these bindings do not need
explicit level declarations to be imported at levels other than 0 (this
convenience is the entire purpose of "implicit phasing"), and in
"explicit-phasing" systems, these bindings get the benefit of "implicit
phasing" but all other bindings do not get the benefit. If the purpose
of "explicit phasing" is to make it explicitly declared at what phases
bindings exist, then how can you reconcile this "implicit phasing" (i.e.
lack of explicit declarations) for these R6RS bindings? If the
convenience of not having to make explicit import level declarations for
these bindings is good, then why shouldn't all bindings get this
convenience?, i.e. always "implicit phasing" like psyntax systems and
Ypsilon. Also, these export levels other than 0 really further
complicate the already-confusing "explicit phasing" levels arithmetic
necessary to actually use your imports. I doubt "explicit phasing"
helps many people actually understand the ramifications of instantiation
phases because they just try to do the level arithmetic voodoo, probably
with some unnecessary levels thrown in (which is what I've seen people
do) because it's confusing, and continue without further thought.
--
: Derick
----------------------------------------------------------------
William D Clinger
2009-09-16 20:16:14 UTC
Permalink
Thank you, Derick. This is now ticket #654 at
https://trac.ccs.neu.edu/trac/larceny/ticket/654

Will

Loading...