Accessors
Brian Goetz
brian.goetz at oracle.com
Wed Sep 23 15:13:46 UTC 2020
> I must say that I'm totally against introducing so-called properties
> to Java records. So far, Java is a very clear language. If I see `x =
> foo.bar`, I definitely know that it's a very simple field dereference
> and assignment action. By no means, this line may perform a network
> request or a database query. So when debugging, I don't expect
> anything funny with this line of code. I don't need to navigate to
> `foo` or `bar` definition to understand what's going on here. It's a
> great feature, compared to other modern languages where many things
> could be overridden and it's impossible to understand what's going on,
> simply by looking at the code line. I don't want to lose this feature
> in Java for the sake of saving two characters.
Or, to put in "language-designer-speak": field access has a known cost
model and error model; property access has neither.
Reading code is more important than writing code.
More information about the amber-dev
mailing list