Re: Will Closures Make Java Less Verbose?
Posted: Apr 3, 2008 12:11 PM
Thanks for pointing out Steve Yegge's post:
Parts of it made me fall down laughing...
The rest is just insightful.
The post also had an interesting pointer, as well:
* Nice: http://nice.sourceforge.net/language.html
A java-syntax, jvm-compatible language that makes
methods into first class citizens, which allows
for modules and closures, among other things.
That sure looks like Java3K, to me. (I've been saying we need such a thing for years. Once Java got to be a decade old, it seems to me that it was time.)
Many of the comments on that post are intriguing, too. Like this one:
"Java forces you to associate actions not with their
subjects, but most often with their objects"
That's a really interesting observation. A verb connects a
subject and an object. So do we have Steve.take_out(trash),
or Steve.trash.take_out()? Associating the method with the
object gives the latter. Associating it with the subject
gives the former.
But in a sense, take_out is really an /operator/ that joins
the two objects: take_out(Steve, trash)--only it reads better with infix dot-notation:
Interestingly, the dot notation captures the idea that
sequence matters. So while plus(3,4) == plus(4,3),
infix space notation can be used: 3 + 4 == 4 + 3.
But take_out(trash, Steve) fails type checking (static or
dynamic), since the first argument must be an instance
of Person and the second must be an instance of Thing, so
dot-notation is better suited to expressing the concept.