Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using .. for Open Records and ..a for Constrained Records in Types #7094

Open
Tracked by #7091
smores56 opened this issue Sep 18, 2024 · 0 comments
Open
Tracked by #7091

Using .. for Open Records and ..a for Constrained Records in Types #7094

smores56 opened this issue Sep 18, 2024 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@smores56
Copy link
Sponsor Collaborator

smores56 commented Sep 18, 2024

Currently, we use the following syntax for denoting openness/constraint in record types:

OpenRecord1 a : { foo : a, bar : Str }*
OpenRecord2 a : {
    foo : a,
    bar : Str,
}*

ConstrainedRecord1 a b : { foo : a, bar : Str }b
ConstrainedRecord2 a b : {
    foo : a,
    bar : Str,
}b

We want to move to supporting the following syntax instead:

OpenRecord1 a : { foo : a, bar : Str, .. }
OpenRecord2 a : {
    foo : a,
    bar : Str,
    ..
}*

ConstrainedRecord1 a b : { foo : a, bar : Str, ..b }
ConstrainedRecord2 a b : {
    foo : a,
    bar : Str,
    ..b
}

Though we will likely eventually commit to just this new syntax, there is a lot of Roc code that currently implements the first syntax. Ideally, an implementer would support parsing of either of these syntaxes (but only one or the other should be allowed at once), and then format to the new syntax for minimal, automatic effort on the part of Roc devs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant