From b471b188769a9af2be242b76569ad11c1174814c Mon Sep 17 00:00:00 2001 From: AlexKnauth Date: Mon, 18 Mar 2019 09:56:44 -0400 Subject: [PATCH] document procedure behavior of make-variable-like-transformer --- .../syntax/scribblings/transformer.scrbl | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pkgs/racket-doc/syntax/scribblings/transformer.scrbl b/pkgs/racket-doc/syntax/scribblings/transformer.scrbl index 9ef434e937..7b6d4fc530 100644 --- a/pkgs/racket-doc/syntax/scribblings/transformer.scrbl +++ b/pkgs/racket-doc/syntax/scribblings/transformer.scrbl @@ -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))