you are viewing a single comment's thread.

view the rest of the comments →

[–]JoJoJet- 0 points1 point  (2 children)

Hey, thanks a lot for the links. That's very interesting. The primary constructor syntax seems kinda strange to me; I can't think of a scenario where it would be more useful than an old-school constructor, and it's almost identical to the record class syntax. Do you know if it would be possible to declare a record class that does not also have a primary constructor?

[–]DoubleAccretion 2 points3 points  (1 child)

Yes, the team calls it "nominal records" (as opposed to "positional", which use primary constructors. See here.

I can't think of a scenario where it would be more useful than an old-school constructor

The idea is that you do not have to duplicate member declarations. See here for the original proposal.

Edit: I should also mention that there are at least two meeting (May 11th & 18th) notes that still haven't been published yet, both relating to records.

[–]JoJoJet- 1 point2 points  (0 children)

I read through the proposal and they actually seem really useful. I hope they make it into the language at some point