[r6rs-discuss] R6 counterproposal

From: R. Kent Dybvig <dyb>
Date: Tue, 29 May 2007 02:39:37 -0400

> > In my experience, defmacro is capable of defining any syntactic
> > transform that the more modern Scheme macros can.
>
> I should think so: the whole point of high-level macro schemes is that
> they are not Turing-complete over the domain of the source text, and
> therefore they can be given a (partly) declarative interpretation.
> Syntax-rules is of course entirely declarative.

Actually, the point is that they permit one to deal sensibly with lexical
scoping at the source level. This not only simplifies the coding of many
macros but also allows the definition of others that cannot be written
with defmacro. For example, one can use syntax-rules and syntax-case to
write macros that perform arbitrary code motion (e.g., define-integrable)
without breaking lexical scope.

In fact, syntax-case is strictly more expressive than the old-style Lisp
macros represented by defmacro. The lisp-transformer on page 54 of the
library document shows how syntax-case can be used (trivially) to write
old-style Lisp macros. Defmacro itself is easily defined using
lisp-transformer.

In other words, hygienic macros are an enabling technology, not a limiting
one, despite a common misconception to the contrary. They help prevent
unintended captures and allow the definition of certain macros that cannot
otherwise be defined, but you don't lose anything by using them, not even
the ability to write macros that completely destroy hygiene.

Kent
Received on Tue May 29 2007 - 02:39:37 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC