Supply #f as the first argument to `raise-syntax-error'.
At Tue, 09 Nov 2010 17:31:51 -0700, Jon Rafkind wrote: > It occured to me while making this small patch that the name of the > macro shown in the error message might not be the same as the one the > user called. Namely, if the user renames or prefixes the macro when > requiring it then they will get a mismatch. This seems to be consistent > with how `raise-syntax-error' already works though so is it a big deal? > > On 11/09/2010 05:26 PM, rafk...@racket-lang.org wrote: > > rafkind has updated `master' from 3936a40717 to 81eac261dc. > > http://git.racket-lang.org/plt/3936a40717..81eac261dc > > > > =====[ 1 Commits ]====================================================== > > > > Directory summary: > > 100.0% collects/racket/private/ > > > > ~~~~~~~~~~ > > > > 81eac26 Jon Rafkind <rafk...@racket-lang.org> 2010-11-09 17:23 > > : > > | better error message for define-syntax-rule > > : > > M collects/racket/private/misc.rkt | 22 ++++++++++++---------- > > > > =====[ Overall Diff ]=================================================== > > > > collects/racket/private/misc.rkt > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > --- OLD/collects/racket/private/misc.rkt > > +++ NEW/collects/racket/private/misc.rkt > > @@ -12,18 +12,20 @@ > > (define-syntax define-syntax-rule > > (lambda (stx) > > (syntax-case stx () > > - [(dr (foo . pattern) template) > > - (identifier? #'foo) > > + [(dr (name . pattern) template) > > + (identifier? #'name) > > (syntax/loc stx > > - (define-syntax foo > > - (lambda (x) > > - (syntax-case** dr #t x () free-identifier=? > > - [(_ . pattern) (syntax/loc x template)]))))] > > - [(dr (foo . pattern) template) > > - (raise-syntax-error 'define-syntax-rule "expected an identifier" > stx #'foo)] > > - [(dr (foo . pattern)) > > + (define-syntax name > > + (lambda (user) > > + (syntax-case** dr #t user () free-identifier=? > > + [(_ . pattern) (syntax/loc user template)] > > + [else (raise-syntax-error 'name (format "~a > did not match pattern ~a" (syntax->datum user) '(name . pattern)))] > > + ))))] > > + [(dr (name . pattern) template) > > + (raise-syntax-error 'define-syntax-rule "expected an identifier" > stx #'name)] > > + [(dr (name . pattern)) > > (raise-syntax-error 'define-syntax-rule "no template provided" > stx)] > > - [(dr (foo . pattern) template . etc) > > + [(dr (name . pattern) template . etc) > > (raise-syntax-error 'define-syntax-rule "too many templates" stx > #'etc)] > > [(dr head . template) > > (raise-syntax-error 'define-syntax-rule "invalid pattern" stx > #'head)]))) > > _________________________________________________ > For list-related administrative tasks: > http://lists.racket-lang.org/listinfo/dev _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/dev