[R6RS] libraries

Manuel Serrano Manuel.Serrano
Tue Dec 6 13:14:36 EST 2005

Hello Matthew,

> > Question 1: Is this a legal library?
> > 
> > (library <lib-path> <language>
> >    ...
> >    (define (import x) x)
> >    (import 5))
> If <lib-path> is "scheme://r6rs", then this is illegal, because
> "scheme://r6rs" is defined to export a binding for `import'.
I'm a little bit confused. Are you using a unique environment for 
macros and variables? In other words, do you mean that it is an
error to define a macro and a variable with the same name? I hope not
because I'm strongly opposed to this. I'm used to define
functions that and overridden by macros. If find this very convenient
and efficient and I would be extremely sorry to loose this capacity...

> > Question 3: From your perspective, is this a legal library?
> > 
> > (library <lib-path> <language>
> >    ...
> >    (display x)
> >    (define (x) 5)
> Same as above, to me.
If I understand you correctly:

(library <lib-path> <language>
  (define (odd x) ... (even x) ...)
  (define (even x) ... (odd x) ...)
  (odd 5)

is correct, but

(library <lib-path> <language>
  (define (odd x) ... (even x) ...)
  (odd 5)
  (define (even x) ... (odd x) ...)

is incorrect. Right?

> I thought that we settled on exported bindings as mutable, and that
> it's one of the motivations for indirect exports.
No, I don't think so. I remember the opposite choice. Exporting
mutable bindings breaks too many optimizations (unless you have an additional
mean to specify that an export is read-only, of course).

> I think the `library' form has to work well with macros, or it won't be
> a useful standard (and "work well" to me means "obeys lexical scope").
> If there's disagreement on this point, we should certainly discuss it
> further.
I imagine that I will be pretty alone on this side but no, I don't
think that I want to enforce macros to use lexical scoping. I think
that, at least, we should not specify this in the library specification. In
particular, I think that we can adopt SYNTAX-CASE. We can specify that
macros defined with SYNTAX-CASE are hygienic but I don't think that we
should specify that a Scheme that uses traditional Lisp macros cannot
be R6Rs because of the specification of the LIBRARY form. 

> It should clearly ban cyclic dependencies. I'll work on that.
I don't have a strong opinion here. (Bigloo modules are cyclic. This is
sometime comfortable but it also causes initialization problems.) By
contrast, you seem to have a strong opinion. Could you elaborate? Thanks. 


More information about the R6RS mailing list