[R6RS] Internal DEFINE vs. macros
dyb at cs.indiana.edu
Tue Apr 12 15:03:11 EDT 2005
> No, because you can't have shadowing-by-nesting at the top level.
> That's where the (most serious, IMHO) ambiguities come from.
That depends on the top-level or module model. For example, definitions
within a module may be able to shadow bindings imported into the module.
> Kent> I think you are running up against the fact that Chez Scheme does
> Kent> not treat the forms within a let-syntax and letrec-syntax as bodies;
> Kent> instead, let-syntax and letrec-syntax are treated like begin. This allows
> Kent> let-syntax and letrec-syntax forms to be treated as definitions in the
> Kent> same sense that begin is treated as a definition.
> OK, I accept the explanation, but this behavior is highly confusing to
> me. It's also another facet of this whole thing to pin down.
Yes, it is a bit confusing, since let-syntax and letrec-syntax look like
let and letrec, and the latter are not splicing constructs.
> Also, I'm curious what the rationale for this in Chez is.
The rationale is that there's no inherent reason for let-syntax and
letrec-syntax to create new binding contours and it's more general not to.
That is, we can express the one that creates a new binding contour with
the one that doesn't (by wrapping the body in a let as my example showed)
but we can't express the latter with the former.
> you just get the same effect (macros local to a set of definitions)
> via MODULE?
Good intuition. We can easily use local modules to achieve the same
effect as splicing letrec-syntax, and with some work, even achieve the
same effect as splicing let-syntax. Local modules also more generally
give us the effect of a splicing semantics for letrec and let.
The splicing semantics for let-syntax and letrec-syntax predated the
module system, however.
I'm inclined not to go with the splicing semantics for r6rs, but to
keep the r5rs semantics, even if we don't standardize on local modules
at this point.
More information about the R6RS