Re: The Closure Controversy
Jon Harrop writes:
If the problem were social the Java community would not be
working so hard to adopt features like closures.
Stefan Ram wrote:
Remarkably, Guy Steele claimed that once the Java community
was working hard to /remove/ features like closures.
?Guy Steele wrote:
Actually, the prototype implementation *did* allow
non-final variables to be referenced from within
inner classes. There was an outcry from *users*,
complaining that they did not want this!?
http://madbean.com/2003/mb2003-49/
Who is this "Java community" really? Do those who claim to speak for it
really do so?
There wouldn't be a "Closure Controversy", as this thread is entitled, if
support for it were so universal.
This Java programmer happens to like anonymous class syntax. While I have
seen what closures can do for those who initially *write* code, it seems less
kind to maintainers. Perhaps from being clean-up for so many code bases over
the years, I have grown leery of too-clever, too-compact idioms that require a
maintainer to hunt all over source just to see what "x,y => majorOp( x
).convolve( y )" means. At the expense of initial verbosity on the part of
the programmer, who otherwise might be sorely tempted to leave out critical
self-documentation, Java maintainers get a literate, connected and somewhat
self-explanatory inner class.
Those who complain that the syntax is "ugly" are probably right, but it's hard
to put an engineering value on such an assessment. Besides, properly indented
inner classes aren't so hard to read, and in the end are easy enough to
maintain for someone schooled in the idiom.
Arguably, closure syntax is just as transparent given similar familiarity.
The question is whether their introduction into Java provides enough benefit
to offset feature creep (leaving aside Java II, just when you thought it was
safe to dip into the JVM again), or whether current idioms do enough that we
will just live without closures. It's not so much if they're better, as
whether they're better enough.
Perhaps those intimately familiar with the reasons why Guy Steele's "*users*"
raised such an outcry would share them with us.
--
Lew