rhombus-prototype icon indicating copy to clipboard operation
rhombus-prototype copied to clipboard

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

Open usaoc opened this issue 1 year ago • 1 comments

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.

usaoc avatar Jan 12 '24 08:01 usaoc

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.

mflatt avatar Jun 18 '24 14:06 mflatt