Re: the Java Lang will support Properties in Futuere?



Arne Vajhøj wrote:
Lew wrote:
Mark Space wrote:
mttc wrote:
There have many debate and page on the Internet. I say to java
[sic] Leaders
do what developer ask!

Yes, do what developers ask, don't change it. Leave the setters
and
getter alone.

Hear! Hear!

There are Java developers that would like to see properties and
my understanding is that it is heavily discussed for Java 1.7.

Personally I do not see the point though. A method call should
look like a method call.

The usual point is that if you have a property-like thing, then

1. Client code needn't be aware whether you implement it as a field or
a getter/setter pair
2. You should be able to change that (almost always from field to
method pair) without changing client code.

Both of these are sensible enough, but undercut by

A. No one with any sense would implement it as a public field in the
first place.
B. In almost all implementations (including .NET), even if the syntax
for client field access and client property access are identical, the
generated code is quite different, so the change requires recompiling
all the clients anyway. That is, even if it's source compatible, it's
binary incompatible, and thus a very bad idea in a library.

So you're left with argument C:

C. No one with any sense has mutable public fields, so syntax like

a.foo = 12;
b = a.foo; / lowercase "foo", thus not a constant

is more or less unused, and thus available to distinguish between
properties and other sorts of methods.

Less compelling, at least IMHO.


.