«« Next » « Previous
«« Next » « Previous

Link Details

Link 74533 thumbnail
User 111696 avatar

By bloid
via adam-bien.com
Published: Apr 07 2008 / 14:13

The term "closure" is defined as follows: "In computer science, a closure is a function that is evaluated in an environment containing one or more bound variables. When called, the function can access these variables. The explicit use of closures is associated with functional programming and with languages such as ML and Lisp. Constructs such as objects in other languages can also be modeled with closures"
  • 11
  • 2
  • 1245
  • 442

Comments

Add your comment
User 276353 avatar

Umberto Zappia replied ago:

1 votes Vote down Vote up Reply

*A closure is a FUNCTION that refers to free variables in its lexical context.
*A function is a block of code with parameters. It may produce a result value.
*A free variable is an identifier used but not defined by the closure.

I think implementing Closures to the next release of the JDK will bring lots of benefit/flexibility/power, the intend is for Closure to be simple and not to re-consider the whole Java platform (commonly held misconception).
====================================
Main goals for closures are:
*Enable control abstraction APIs
*Concise "function" literals without the problems of anonymous instances
*Interoperate with existing APIs
*Functional and Aggregate Operations
*Simple but powerful

User 152955 avatar

Gregg Bolinger replied ago:

2 votes Vote down Vote up Reply

I just wish that Java as a language would stop changing. If Sun/Community wants functional language aspecs then use an existing vm compliant language (groovy, scala, etc) or write a new one. The focus should be on improving the VM. Forget syntax.

User 187417 avatar

sproketboy replied ago:

0 votes Vote down Vote up Reply

gdboling is 100% right. Closures and other candy violate the read friendly nature of the Java language. We don't want Java to become a kitchen sink language like C#.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (11)



Voters Against This Link (2)