Confusing error for (define-macro (id x ...) ....) #9

Closed
opened 7 years ago by bennn · 3 comments
bennn commented 7 years ago (Migrated from github.com)

When an ellipses follows a non-wildcard variable, define-macro can give a strange error message. E.g.:

#lang racket/base
(require br/define (for-syntax racket/base))

(define-macro (my-begin x ...)
  #'(begin x ...))

Error message:

$ raco make foo.rkt
foo.rkt:5:13: syntax: no pattern variables before ellipsis in template
  at: ...
  in: (begin x ...)

define-macro should warn about ... that don't come after a wildcard (I think that's the only place they're allowed)

When an ellipses follows a non-wildcard variable, `define-macro` can give a strange error message. E.g.: ``` #lang racket/base (require br/define (for-syntax racket/base)) (define-macro (my-begin x ...) #'(begin x ...)) ``` Error message: ``` $ raco make foo.rkt foo.rkt:5:13: syntax: no pattern variables before ellipsis in template at: ... in: (begin x ...) ``` `define-macro` should warn about `...` that don't come after a wildcard (I think that's the only place they're allowed)
mbutterick commented 7 years ago (Migrated from github.com)

Closed by #10

Closed by #10
mbutterick commented 7 years ago (Migrated from github.com)

define-macro should warn about ... that don't come after a wildcard (I think that's the only place they're allowed)

They are also allowed after subpatterns like ((X ...) ...) Unfortunately your patch did not handle these correctly.

> `define-macro` should warn about `...` that don't come after a wildcard (I think that's the only place they're allowed) They are also allowed after subpatterns like `((X ...) ...)` Unfortunately your patch did not handle these correctly.
mbutterick commented 7 years ago (Migrated from github.com)

I believe f0ec809502 does what you originally intended.

I believe f0ec809502bb980a97a0fdcf98942f19d9dfc37d does what you originally intended.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: mbutterick/beautiful-racket#9
Loading…
There is no content yet.