/guid/9202a8c04000641f80000000000769c6 rename
Summary
In computer science, a closure is a first-class function with free variables that are bound in the...
Content
In computer science, a closure is a first-class function with free variables that are bound in the lexical environment. Such a function is said to be "closed over" its free variables. A closure is defined within the scope of its free variables, and the extent of those variables is at least as long as the lifetime of the closure itself. The explicit use of closures is associated with functional programming and with languages such as ML and Lisp. Closures are used to implement continuation passing style, and in this manner, hide state. Constructs such as objects and control structures can thus be implemented with closures.
The concept of closures was developed in the 1960s and was first fully implemented as a language feature in the programming language Scheme. Since then, many languages have been designed to support closures.
In some languages, a closure may occur when a function is defined within another function, and the inner function refers to local variables of the outer function. At runtime, when the outer function executes, a closure is formed, consisting of the inner function’s code and references to any variables of the outer function required by the closure; such variables
Created by:
Freebase Data Team
Oct 22, 2006
Last edited by:
Freebase Data Team
Oct 22, 2006
Recent Discussions about None
There is no discussion about this document.
Start the Discussion »