-
Notifications
You must be signed in to change notification settings - Fork 205
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
Primary constructors with curly brackets for user-named fields #3198
Comments
A primary constructor is, as discussed so far, very much a parameter list with extra keywords allowed (because each parameter is also going to declare a field, and the fields may need more keywords). What you describe is how named parameters are already written, so it's pretty much a given that the syntax for primary constructors will use that for named parameters. I'm less enthusiastic about omitting the name for a positional field, because Records got the And there is no way that primary constructors will not allow |
I'm relieved. |
this one? Is "Alternative:" user selectable option, or language designers option? |
I believe the most current proposal for primary constructors is the open PR #3023 |
Thank you. |
For consistency with records, like
, I think that primary constructors should have syntax with curly brackets for user-named fields, like
.
My understanding is that data classes are records with class names, both of them share characteristics of simple, immutable, unboxing optimization friendly, without persistent identity, and with structural equality, in other words value types, then syntactic consistency is important.
The text was updated successfully, but these errors were encountered: