Skip to content

Macros-by-example expr metavariable substitution behaves as if parenthesized #1372

Open
@8573

Description

@8573

While reviewing some code, I saw a macro-by-example using a metavariable of type expr in such a way that the code would be wrong if an expression were given to the macro that needed to be parenthesized — so I thought. Testing in the Playground, I found that substituted expressions appeared to be parenthesized automatically. I checked the Reference's section on macros-by-example and saw nothing about this; I looked at the Book's section on macros-by-example and saw nothing about this, but the Book suggested for further reading https://veykril.github.io/tlborm/, which explains that expressions are substituted as AST nodes rather than as tokens and so behave as if parenthesized. I suggest that this be mentioned in the Reference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions