Skip to content

Conversation

@edgarfgp
Copy link
Member

@edgarfgp edgarfgp commented Sep 8, 2025

Click “Files changed” → “⋯” → “View file” for the rendered RFC.

@Martin521
Copy link
Contributor

Martin521 commented Sep 9, 2025

EDIT: moved to discussion

@edgarfgp
Copy link
Member Author

This is ready :)

Copy link
Contributor

@Martin521 Martin521 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems line 250 and 301 are inconsistent.
Else this looks very good.

Comment on lines +250 to +254
// | R(a = x, b = y, c = z,) -> ... // trailing comma — OK
```

Notes:
- Newlines can separate fields as today. Trailing `,` or `;` after the last field are allowed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This surprises me.

I understand why trailing ; was allowed here: it is also allowed in any other scenario where ; is used as a separator (sequential expressions and anything based on them, record fields, etc.).

To my knowledge, however, there is no existing construct in F# that permits a trailing comma — certainly not union constructors, which this update is ostensibly meant to mirror.

It feels like symmetry with the construction syntax (no trailing commas) should be given more weight here than parity with the ;-based syntax that this is meant to supersede.

Support for trailing commas more generally might be better served by its own, separate suggestion and RFC.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like symmetry with the construction syntax (no trailing commas) should be given more weight here than parity with the ;-based syntax that this is meant to supersede.

Good point. I agree

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you planning further changes to the RFC?

Comment on lines +229 to +246
```fsharp
type R = R of a:int * b:int * c:int

let exNewlines (r: R) =
match r with
| R(
a = x, // newline as separator OK with ,
b = y,
c = z
) -> x + y + z

let exNewlinesSemicolons (r: R) =
match r with
| R(
a = x; // newline as separator OK with ;
b = y;
c = z
) -> x + y + z
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify: newlines without ; were allowed as separators before, including mixed usage —

let exNewlinesSemicolons (r: R) =
    match r with
    | R(
        a = x
        b = y; // Semicolon allowed but not required after any of these lines
        c = z
      ) -> x + y + z

Is this implying that similar mixed usage would be allowed with commas as well? (I would advise against allowing that, since mixed commas/newlines are not allowed in any other comma-based syntax, including union constructors.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants