Closed
Description
For consistency with records, like
typedef R = (int, {int a, int b});
R r = /* R */(1, a:2, b:3);
main(){
print(r.$1);
print(r.a);
print(r.b);
}
, I think that primary constructors should have syntax with curly brackets for user-named fields, like
data class D(int, {int a, int b});
D d = D(1, a:2, b:3);
main(){
print(d.$1);
print(d.a);
print(d.b);
}
.
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.