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.


.



Relevant Pages

  • Re: Socket Connection Times out
    ... I have removed the Semaphore object creation and tried running the client ... Client Code: ... SPIOPACKET pIOPacketRet = NULL; ...
    (microsoft.public.win32.programmer.networks)
  • Re: Can I create a remote object without a DLL on the client?
    ... There is no magic -- the client needs to know SOMETHING about the ... server if it wants to interact with it. ... Look at it another way -- why not prototype some client code that would ... because that's the nature of these languages. ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: VS 2005 SP1 Hangs while typing
    ... The problem appears that I was writing out client code using a StringBuilder ... client code that the Composite control needs to write out. ...
    (microsoft.public.vstudio.general)
  • Re: use of assert in Java [vs. exceptions]
    ... client code to do so instead. ... So just prior to calling that method from ... the client code we could certainly use assertions, ... There are several products that offer a proper DbC implementation in Java ...
    (comp.lang.java.programmer)
  • Re: ADO data type validation is inconsistant with SS2Ks
    ... a fatal error or exception on the client and needs to be explicitly ... fails on the server, the server simply moves on to the next statement ... equivalent non-zero error code value in client code would. ... client code as possible, and send only valid data to the server. ...
    (microsoft.public.dotnet.languages.vb)