syntax/parse docs: avoid phase arith discussion

Please apply to release branch.

svn: r16046
This commit is contained in:
Ryan Culpepper 2009-09-17 15:59:29 +00:00
parent fcbe2cd7d3
commit 880f7f2707

View File

@ -170,28 +170,10 @@ identifier as a binding, in which case it would get the value
Here's how the syntax class would change:
@schemeblock[
(define-syntax-class binding
#:attributes (x e)
(pattern (x:id e:expr))
(pattern x:id
#:with e #'(quote #f)))
]
@bold{Note: } The syntax template @scheme[#'#f] in the definition
above represents an expression that gets inserted by the macro. The
expression will be interpreted at phase 0 with respect to the macro
(@schemekeywordfont{mylet}), but the module containing
@scheme[binding] is required at phase 1. The syntax template needs to
be in the context of a binding of @scheme[quote] at phase 0 relative
to the macro, which is phase -1 relative to the module it occurs
in. That means importing @schememodname[scheme/base]
@scheme[for-template] (phase -1).
@SCHEMEBLOCK[
(module example-syntax scheme/base
(require syntax/parse
(for-template scheme/base))
(require syntax/parse)
(require (for-template scheme/base))
(provide binding)
(define-syntax-class binding
#:attributes (x e)
@ -200,6 +182,9 @@ in. That means importing @schememodname[scheme/base]
#:with e #'(quote #f))))
]
@bold{Note: } The @scheme[(require (for-template scheme/base))] is
needed for the @scheme[quote] expression.
If the syntax class definition were a local definition in the same
module, the @scheme[for-template] would be unnecessary.