On 13 September 2011 16:31, clay <[email protected]> wrote: > "This breaking news, just in: C has objects, and Lisp has static > types." > > Rather than all the snarky replies, how about you actually explain > what makes the Closure-like functionality in Java not really true > closures? > > I can articulate exactly why C doesn't have real objects. You can do > OO style programming in pure C, and you design your code as "objects" > in the conceptual sense, but you don't have language level support for > it. >
Quite! You can do functional style programming in pure Java, and you design your code as "functions" in the conceptual sense, but you don't have language level support for it. > People say "Java doesn't have closures" so frequently that people > believe it. But it is really just a common misuse of terminology. What > (I think) people mean, when they say that, is that Java doesn't have > first class functions (functions as objects) and a concise anonymous > functions syntax. But, closures is a feature that Java has always had. > I'm not trolling, I'm just trying to get the labels and terminology > accurate and clear. > > If "Java has closures" is discussed in terms of what is possible, regardless of of the need to use lots of boilerplate or an awkward encoding for "Favourite paradigm #3(tm)", then we may as well extrapolate to the logical conclusion that every language has every feature so long as it's Turing complete. Ultimately, *anything* is possible in a turing-complete language, even BrainF**k, so long as you're willing to jump through enough hoops. This is not the generally accepted meaning when someone states that language X "has" feature Y, or else we'd all be running around claiming that every language has every feature and we'd have a very difficult time talking about disambiguating features on this very mailing list. The usual understanding of the phrase "lang X has Y" is that "language X has semantic constructs in support of feature Y". Closures are defined in terms of functions, and Java most certainly does NOT have semantic support for functions as a first class construct (and no, methods are not the same thing). Ergo, Java does not have closures. -- 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.
