On Tue, Sep 13, 2011 at 12:49 PM, clay <[email protected]> wrote:
> Ben + Josh, is this an accurate summary of your viewpoints: Java
> doesn't have true closures because of the "final" variable requirement
> and that any mutability of "closed" variables from the outer
> environment requires a level of indirection.
>
> That's a logically consistent argument, although it's real language
> lawyer, splitting hairs argument.

I offered that I am the one being pedantic.  :)  How do you feel about
whether or not java has "pass by reference?"  For those that care that
objects are not copied to the stack, the fact that you can not write a
swap is likely a splitting hairs argument, as well.  (For those that
care about the swap, it is key.)

And, yes, I have had several times when I would have liked to do something like:

for (int x = 0; x < count; x++ ) {
    new Runnable() { public void run() {someFunctionOn(x);}}.run();
}

This would require a closure.  A function literal would help, but a
closure is necessary to make it work.


> I'd still say that the language level limitations that are holding
> Java back from a more functional programming style isn't the "final"
> variable restriction of Closure like functionality, but the lack of
> first class functions and a more concise anonymous function syntax.
> And, ideally, Java would have a standard collections library with
> persistent immutability support (like Scala's collections).
>

I don't disagree.  What you are describing, though, sounds like you
really should jump ship to one of the alternative languages.  Not
because java sucks, but because other languages have what you want.

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to