No... It hasn't

In order to have closures, you must first have functions (as per your
definition).  Functions being first-class entities that can be freely passed
around.

Java doesn't have functions, therefore it can't have closures.

It does have objects and methods though, so you can make a good
approximation of a function by using a SAM (single abstract method) type.
 You can even name the class "Function" if you so wish, but it's still an
abstraction in the mind of the developer, it isn't a core construct in the
language.



On 12 September 2011 20:32, clay <[email protected]> wrote:

> On the recent episode of Java Posse, several people referred to Java's
> lack of closures. This is wrong. Java has full closures and has always
> had them.
>
> A closure is when you define a function that "closes" over the local
> environment from which the new function is defined and can access
> local variables of that defining scope. Java absolutely does this.
>
> I've recently done some programming with GWT (Java), JavaFX 2 (in
> Java), and client-side JavaScript (not Java), and we've been using
> closures quite extensively in all three.
>
> --
> 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.
>
>


-- 
Kevin Wright
mail: [email protected]
gtalk / msn : [email protected]
quora: http://www.quora.com/Kevin-Wright
google+: http://gplus.to/thecoda
<[email protected]>
twitter: @thecoda
vibe / skype: kev.lee.wright
steam: kev_lee_wright

"My point today is that, if we wish to count lines of code, we should not
regard them as "lines produced" but as "lines spent": the current
conventional wisdom is so foolish as to book that count on the wrong side of
the ledger" ~ Dijkstra

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