2 ms·
> I didn't expect to get an answer by the actual authors of the feature :) I am not an author of that particular feature, but I work with them on OpenJDK. > Y
by pron 4y ago
> I didn't expect to get an answer by the actual authors of the feature :)
I am not an author of that particular feature, but I work with them on OpenJDK.
> Yes, you can add custom formatting rules to stop that, but that's additional effort ... It's also more cognitive effort to parse the code
Perhaps, but using `;` has its own downsides (it's different from all other type declarations both for readers and for the language's grammar). The choice is never between something good and something bad, but between two things that are both good and bad.
Given that a record can save you tens of lines, on the whole it was decided that it's not worth it to add a new rule that saves a single additional character at this time. It can always be added later.
> That rule already has lots of exceptions, e.g. methods are not type declarations (like you said) and neither are initializers. Nevertheless, both use braces and leave out the ; at the end.
That's not the rule, though. I didn't mean that only type declarations use {}, but that all type declarations use {}. I don't think there are any exceptions.