racket / rhombus

Rhombus programming language
Other
350 stars 62 forks source link

Not all macro options are allowed in pre-alts block position #464

Open usaoc opened 10 months ago

usaoc commented 10 months ago

Example:

#lang rhombus/and_meta
expr.macro self_quote:
  ~op_stx self
| 'self_quote':
    '#%literal $(self.to_source_string())'

Options like op_stx, all_stx, etc., seem to be allowed only in the “right-hand side” position.

mflatt commented 4 months ago

This was an intentional choice in the implementation, although I see that it's not documented right. The rationale behind the current choice is that options like ~op_stx and ~all_stx bind names that are only visible after he pattern, and it's weird to have a declaration of a name that is bound separately in multiple nested forms. So, I'm currently inclined to improve the documentation, but I don't think the choice is obvious.