I don't wanna argue semantics. That said, what we're getting in Java 8 isn't true closures. The important distinction is that we don't get full execution flow control. All we get is, as you said, syntactic niceties. Now, the syntactic niceties are, of course, nice. And I'm not a language zealot and therefore will not jump off a cliff because Java doesn't have "true" closures. But in the real sense of the word, it doesn't. Alexey
________________________________ From: Cédric Beust ♔ <[email protected]> To: [email protected] Sent: Monday, September 12, 2011 4:05 PM Subject: Re: [The Java Posse] Re: Java Has Always Had Closures On Mon, Sep 12, 2011 at 12:55 PM, Ben Schulz <[email protected]> wrote: On 12 Sep., 21:32, clay <[email protected]> wrote: >> 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. >Not just local variables, anything denotable from the enclosing scope, >such as the method equals(Object), which happens to have a different >meaning inside the "closure" than outside. This is a contradiction of >your very definition ("a closure is a function which closes over the >[lexically enclosing] environment") and thus disproves your >hypothesis. >q.e.d. > Technically true but practically irrelevant. Jave has indeed had closures since day one (e.g. Runnable, Callable, etc...). If you're not convinced, ask yourself the following question: is there any programming construct that you will be able to do in Java 8 with closure support that you can't do today with Runnable? None. The syntax will be nicer, but that's all Java 8 is adding in that area. -- Cédric -- 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. -- 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.
