[R6RS] libraries

Matthew Flatt mflatt
Tue Dec 6 16:55:40 EST 2005

At Tue, 6 Dec 2005 18:55:35 +0100, "Manuel Serrano" wrote:
> 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?

Yes. It seems that we simply disagree on this point.

> 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).

Let's take a new poll. I favor immutability, but I have to admit that
it seems a bit inconsistent with the rest of Scheme.

> > 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. 

If an implementation supports defmacro, then certainly such macros
wouldn't be required to obey lexical scope. Where the SRFI says
"macros", I had in mind "macros defined using standard mechanisms",
which I expect to be `syntax-rules' and `syntax-case'. In any case, I
think the library and macro standard parts of the will have to
reference each other.


More information about the R6RS mailing list