Skip to content

Require parentheses around throw expressions #23

@rbuckton

Description

@rbuckton

Neither #17 nor #18 were able to achieve consensus at the September, 2023 plenary session. As a result, I am considering alternative approaches to the syntax to achieve consensus. The approach that seems to be most likely to reach consensus is to require throw expressions be surrounded by parentheses.

There are two mutually-exclusive mechanisms we could employ to achieve this:

  1. Move 'throw' to Expression #21 - Move throw expressions to Expression, making them mutually exclusive with ,, and change the operand to allow Expression.
  2. Move 'throw' to ParenthesizedExpression #22 - Move throw expressions to ParenthesizedExpression, making them mutually exclusive with ,, and change the operand to allow Expression.

Option 1 allows throw expressions to be unparenthesized in a small number of cases where Expression is directly referenced within the specification, but most of those cases have arguable utility (i.e., if (throw e)).

Option 2 always requires throw expressions be parenthesized, even in the cases where they would be allowed in Option 1 (i.e., if ((throw e))).

It is important to note that if we opt to go ahead with Option 2 (#22) and that ended up shipping in Stage 4, we would still be able to change this to Option 1 (#21) in the future without introducing a breaking change. However, if we opt to go with Option 1 (#21), we would not be able to go back to Option 2 once this feature ships.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions