fix typos in macro guide
This commit is contained in:
parent
87a1506ef4
commit
68cf924000
|
@ -40,7 +40,7 @@ followed by an identifier, which is @racket[swap] in this case. After
|
|||
the initial identifier, other identifiers are @deftech{macro pattern
|
||||
variables} that can match anything in a use of the macro. Thus, this
|
||||
macro matches the form @racket[(swap _form1 _form2)] for any
|
||||
@racket[_form_1] and @racket[_form_2].
|
||||
@racket[_form1] and @racket[_form2].
|
||||
|
||||
@margin-note{Macro pattern variables are similar to pattern variables for
|
||||
@racket[match]. See @secref["match"].}
|
||||
|
@ -179,7 +179,7 @@ using @racket[syntax-rules]:
|
|||
|
||||
The expression @racket[(rotate red green)] matches the first pattern
|
||||
in the @racket[syntax-rules] form, so it expands to @racket[(swap red
|
||||
green)]. The expression @racket[(rotate a b c)] matches the second
|
||||
green)]. The expression @racket[(rotate red green blue)] matches the second
|
||||
pattern, so it expands to @racket[(begin (swap red green) (swap green
|
||||
blue))].
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ answer is that @racket[#'age] captures both.
|
|||
The relevant binding of @racket[age] captured by @racket[#'age] is
|
||||
determined when @racket[#'age] is eventually used. As an example, we
|
||||
bind @racket[#'age] to a pattern variable so we can use it in a
|
||||
template, and then we @racket[eval]utae the template: @margin-note*{We
|
||||
template, and then we @racket[eval]uate the template: @margin-note*{We
|
||||
use @racket[eval] here to demonstrate phases, but see
|
||||
@secref["reflection"] for caveats about @racket[eval].}
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ point directly to the source location of the non-identifier.
|
|||
@section[#:tag "with-syntax"]{@racket[with-syntax] and @racket[generate-temporaries]}
|
||||
|
||||
Since @racket[syntax-case] lets us compute with arbitrary Racket
|
||||
expression, we can more simply solve a problem that we had in
|
||||
expressions, we can more simply solve a problem that we had in
|
||||
writing @racket[define-for-cbr] (see
|
||||
@secref["pattern-macro-example"]), where we needed to generate a
|
||||
set of names based on a sequence @racket[id ...]:
|
||||
|
@ -323,7 +323,7 @@ This way of generating identifiers is normally easier to think
|
|||
about than tricking the macro expander into generating names with
|
||||
purely pattern-based macros.
|
||||
|
||||
In general, the right-hand side of a @racket[with-syntax]
|
||||
In general, the left-hand side of a @racket[with-syntax]
|
||||
binding is a pattern, just like in @racket[syntax-case]. In fact,
|
||||
a @racket[with-syntax] form is just a @racket[syntax-case] form
|
||||
turned partially inside-out.
|
||||
|
@ -335,10 +335,10 @@ turned partially inside-out.
|
|||
As sets of macros get more complicated, you might want to write
|
||||
your own helper functions, like
|
||||
@racket[generate-temporaries]. For example, to provide good
|
||||
syntax-error messsage, @racket[swap], @racket[rotate], and
|
||||
syntax error messsages, @racket[swap], @racket[rotate], and
|
||||
@racket[define-cbr] all should check that certain sub-forms in
|
||||
the source form are identifiers. We could use a
|
||||
@racket[check-ids] to perform this checking everywhere:
|
||||
@racket[check-ids] function to perform this checking everywhere:
|
||||
|
||||
@racketblock/eval[
|
||||
#:eval check-eval
|
||||
|
|
|
@ -167,14 +167,14 @@ that contains nested @racket[define-values] forms.
|
|||
|
||||
The default application of dye packs can be overridden by attaching
|
||||
a @racket['taint-mode] property (see @refsecref["stxprops"]) to the
|
||||
result syntax object of a macro transformer. If the property value is
|
||||
resulting syntax object of a macro transformer. If the property value is
|
||||
@racket['opaque], then the syntax object is armed and not its
|
||||
parts. If the property value is @racket['transparent], then the
|
||||
syntax object's parts are armed. If the property value is
|
||||
@racket['transparent-binding], then the syntax object's parts and to
|
||||
@racket['transparent-binding], then the syntax object's parts and
|
||||
the sub-parts of the second part (as for @racket[define-values] and
|
||||
@racket[define-syntaxes]) are armed. The @racket['transparent] and
|
||||
@racket['transparent-binding] modes triggers recursive property
|
||||
@racket['transparent-binding] modes trigger recursive property
|
||||
checking at the parts, so that armings can be pushed arbitrarily deep
|
||||
into a transformer's result.
|
||||
|
||||
|
@ -183,7 +183,7 @@ into a transformer's result.
|
|||
|
||||
Tools that are intended to be privileged (such as a debugging
|
||||
transformer) must disarm dye packs in expanded programs. Privilege is
|
||||
granted through @deftech{code inspectors}. Each dye pack records and
|
||||
granted through @deftech{code inspectors}. Each dye pack records an
|
||||
inspector, and a syntax object can be disarmed using a sufficiently
|
||||
powerful inspector.
|
||||
|
||||
|
@ -227,7 +227,7 @@ racket
|
|||
(protect-syntax #'(unchecked-go 8 x))])))]))
|
||||
]
|
||||
|
||||
When @racket[def-go] is used inside another module to defined
|
||||
When @racket[def-go] is used inside another module to define
|
||||
@racket[go], and when the @racket[go]-defining module is at a
|
||||
different protection level than the @racket[def-go]-defining module, the
|
||||
generated macro's use of @racket[protect-syntax] is not right. The
|
||||
|
|
Loading…
Reference in New Issue
Block a user