document procedure behavior of make-variable-like-transformer
This commit is contained in:
parent
780647f0eb
commit
b471b18876
|
@ -8,20 +8,24 @@
|
|||
|
||||
@defmodule[syntax/transformer]
|
||||
|
||||
@defproc[(make-variable-like-transformer [reference-stx syntax?]
|
||||
[setter-stx (or/c syntax? #f) #f])
|
||||
set!-transformer?]{
|
||||
@defproc[(make-variable-like-transformer
|
||||
[reference-stx (or/c syntax? (-> identifier? syntax?))]
|
||||
[setter-stx (or/c syntax? (-> syntax? syntax?) #f) #f])
|
||||
(and/c set!-transformer? (-> syntax? syntax?))]{
|
||||
|
||||
Creates a transformer that replaces references to the macro identifier
|
||||
with @racket[reference-stx]. Uses of the macro in operator position
|
||||
are interpreted as an application with @racket[reference-stx] as the
|
||||
function and the arguments as given.
|
||||
function and the arguments as given. If the @racket[reference-stx] is
|
||||
a procedure, it is applied to the macro identifier.
|
||||
|
||||
If the macro identifier is used as the target of a @racket[set!] form,
|
||||
then the @racket[set!] form expands into the application of
|
||||
@racket[setter-stx] to the @racket[set!] expression's right-hand side,
|
||||
if @racket[setter-stx] is syntax; otherwise, the identifier is
|
||||
considered immutable and a syntax error is raised.
|
||||
considered immutable and a syntax error is raised. If
|
||||
@racket[setter-stx] is a procedure, it is applied to the entire
|
||||
@racket[set!] expression.
|
||||
|
||||
@examples[#:eval the-eval
|
||||
(define the-box (box add1))
|
||||
|
|
Loading…
Reference in New Issue
Block a user