Properties
Ron Pressler
ron.pressler at oracle.com
Wed Apr 24 13:09:09 UTC 2024
> On 24 Apr 2024, at 13:54, ІП-24 Олександр Ротань <rotan.olexandr at gmail.com> wrote:
>
>
> Firstly, I have already addressed that setters are effectively inevitable, init only fields could do the trick you are trying to do by disencouraging setters (which is a great by the way, I also think that even for mutable objects immutability should be preserved where possible).
While setters remain inevitable, if the need for them drops, the problem of writing them more easily becomes smaller, and a smaller problem doesn’t justify a language feature as much as a bigger problem. It makes the cost in complexity of the feature higher with respect to its benefit.
>
> About language complication, I get this point, concise syntax of Java is why I fell in love with it in the first place. But as the time moves, it becomes clear that some features just become industry standard: properties, previously discarded extensions, object deconstruction etc. While I agree that language should not just blindly accept every possible feature, wide usage of some may indicate (and indicates) there is a demand for those. I understand the desire to make language better by omitting the road that once tricked languages like c++, but I think sometimes, when demand is high enough, we should let users have what they want. At the end of the day, trere isn't a problem in more flexible approaches, but some of the most common problems, in my opinion, should be addressed specifically. This way we could have a perfect balance between user experience and code quality.
First, I don’t agree that properties have become an industry standard. Not all languages, even those newer than Java have them. Secondly, while there is certainly demand for richer languages, relatively speaking that demand is low. The two languages with similar or higher popularity to Java’s have fewer features than Java, not more. Also, I believe that the most popular languages have rarely been particularly rich compared to the alternative. While I don’t think this correlation necessarily implies causation, certainly not direct causation, it is evidence against causation in the opposite direction — i.e. adding lots of features don’t seem to make languages more popular than languages with fewer features. Of course, as you say, some balance needs to be struck and different languages may address different audiences and find a different balance, our approach is largely focused on spending a lot of time finding the right feature that can address multiple problems. Again, the empirical evidence seems to suggest that a delay in adding features does not seem to adversely affect language adoption.
— Ron
More information about the compiler-dev
mailing list