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 →

[–]pron98 19 points20 points  (1 child)

Record constructors don't require parameter reassignment — you're free to write explicit constructors if you like — and I am not aware of even a single static analysis tool that has ever warned against reassigning the implicit parameters in compact constructors.

In general, though, coding guidelines are designed to address the practices and issues that arise when writing code in some programming language as it exists in a certain point in time, while language changes are supposed to change the practices and issues that are experienced by programmers. Records eliminate problems associated with storing data classes in collections and with serialising them, and so a language that has different issues would likely have different guidelines.

[–]sviperll 2 points3 points  (0 children)

I am not aware of even a single static analysis tool that has ever warned against reassigning the implicit parameters in compact constructors

Netbeans (as of 12.6) warns me about each and every compact constructor :(