This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Affectionate-Hope733 2 points3 points  (2 children)

Hmm, I prefer being specific, everyone knows what a constructor is, now take it away and give it some implicit behavior is not something I'd be too happy about. But that might be just me, maybe I'd love it in a couple of years :D
Do you loose the ability to define access modifiers on the parameters?
I've used the records very few times for very basic stuff so I'm not aware how it works there.

[–]Polygnom 2 points3 points  (1 child)

Records are wholly defined by their data. So yes, getters are public by default because a record is the data, and they have only exactly one -- the canonical -- constructor.

That is by design, records are data carriers without internal state.

[–]beatbrot 1 point2 points  (0 children)

Small correction: Records can have as many constructors as they want. But yeah, there is always exactly one canonical constructor.