[R6RS] Internal DEFINE vs. macros

dyb at cs.indiana.edu dyb
Fri Apr 22 13:06:34 EDT 2005

> To me, the result is a confusing mixture of an operational and
> declarative approach to macro expansion: The first pass is sequential
> and thus sensitive to the ordering of the definition, but the
> following macro expansion of the right-hand sides and body expressions
> is (largely?) insensitive to them.

If it would make you happy, we can specify the order in which the
right-hand sides and body are expanded.

> [obscure example elided]

We can construct obscure examples and fret over their semantics, as we
can with virtually any powerful feature, but what's really important is
(a) whether everyday programs have an obvious meaning and (b) whether we
can puzzle out what an obscure example does when we are presented with it.

> This can be explained operationally in terms of the expansion
> algorithm, but it seems difficult to come up with any declarative
> intuition for it.  I certainly can't just go up through the nesting
> levels and easily associate identifier occurrences with their
> bindings.

You can in most cases.  I agree that it would be nice, in theory, to be
able to do so in all cases, but how much should we be willing to sacrifice
to get this property?  As you've mentioned previously, we'd have to bloat
our record definitions to name all record constructors, predicates,
accessors, and setters, and we'd have to explicitly name all imports.
Now you're saying we'd have to do without internal definitions, or at
least internal syntax definitions.  There are some other things we'd
obviously have to do without, like include and datum->syntax-object.
What's less obvious is that we'd even have to do without syntax-rules
macros (top-level as well as local), since even they can obscure bindings.
Doesn't it make more sense to relax on this issue and use a tool like
MrSpidey when necessary?


More information about the R6RS mailing list