If I have foo.a that has always meant a reference to the field "a" --
both inside foo's implementation and elsewhere.
Using dot notation for properties violates this long held
understanding. Reading "foo.a" in the code suddenly means method calls
(!) -- that's an abrupt and unkind change to all Java code readers alive
today. Worse, use of dot notation necessitates some other nuanced mess
to unambiguously say "hey, I really want to refer to the *field* 'a',
not go through any getter or setter as I'm in the implementation of
"foo" or in a helper in the same package or such.
I have no issue with a more formal notion of properties, but I believe
they absolutely *must* use a new syntax if they're going to implicitly
use getters and setters when present. I believe "->" is the best
candidate of those I've seen.
> Too bad - I almost went and would have voted yes for both! Sorry Joe!
>
I can't see how anyone can support dot notation -- it is this sort of
"oh gosh it is convenient in some case or another" (but causes horrific
effects in all sorts of other cases I personally don't care about in my
environment) feature that I sincerely hope Sun does not let into the
Java language. Autoboxing/unboxing's about as close as I think we
should get to this!
--
Jess Holle
P.S. I'm not even sure we need a "property" keyword. The compiler could
take foo->a and construct a new bytecode that on runtime linking would
look for the appropriate accessor and then look for an accessible field
"a" -- it could even use JavaBeans info to do so when available. This
grandfathers in everything and requires nothing more than -> and a
special bytecode/linker bit. JavaBeans info is clunky, so you could add
annotation support as well -- though I know some of the big-wigs say
anything this important can't be done via annotations...
Stephen Colebourne's recent blog entry adds FCM (First Class Methods)
to the mix for consideration too:
-Van
--
Mike "Van" Riper
van_...@dev.java.net
http://weblogs.java.net/blog/van_riper/
Silicon Valley Web Developer JUG
https://sv-web-jug.dev.java.net
Silicon Valley Google Technology User Group
http://groups.google.com/group/sv_gtug
I'm suggesting steady and careful language evolution, preserving the
integrity of the community and its investment in the platform and
language. Perhaps that comes from many years working on large products
which have to keep working for decades -- while continuing to grow and
evolve steadily, not disruptively. You seem to be insisting on a
disruptive language coup d’état or schism -- violently splitting the
Java community between those ready to jump to a radically new vision and
refactor or box away all existing code and those who aren't or can't. I
don't see the point -- this would seem to only fracture and weaken the
community.
--
Jess Holle