>From the best I can gather, the principle disagreement is definitions.
There are three views in this thread:

A) Java has closures. Closures, by definition, do not necessarily
require lambdas or first class functions, which Java doesn't have.
B) Closures, by definition require lambdas and/or first class
functions, so since Java doesn't have those, it can't have closures.
C) Pure closures, by definition, don't limit you to accessing only
"final" variables, so the anonymous class functionality doesn't
qualify as a closure.

Osvaldo,

Regarding point #1: First, I think you mean anonymous classes, not
inner classes. Secondly, I'd stress that anonymous functions (lambdas)
are a distinct feature from closures.  A language can have one feature
but not the other. Java has closures, but not lambdas. And I can't
think of them off the top of my head, but I'm sure there are languages
with lambdas that don't close over the defining environment, and
therefore don't have closures.

Regarding point #2: I'm not sure what you are getting at here. Sure,
Java is behind the pack in terms of immutable programming and
functional programming support, but you can use third party libraries
like Functional Java and adopt that style as a programmer. Only a few
languages like Haskell really force those concepts on you and
guarantee safety from mutability issues. In Scala, immutable code and
functional programming still requires programmer compliance and it's
easy to write imperative mutable code. Regardless, this seems like a
tangential issue.

Kevin,

I'm not arguing that Java has closures because you can achieve the
same goals without real language level support. I'm arguing that
closures are inner functions/methods that can access variables from
the outer function/method scope, and the Java language syntax
completely supports that. You are claiming that closures require
lambdas by definition, and I disagree with you on that definition.
Java doesn't have lambdas. Sure, you can achieve similar results with
anonymous classes, but the Java language itself doesn't provide
lambdas.

-- 
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