A record storing a Function and its Function Environment in a function such that:

  • Subsequent calls to the same closure can have the same Function Environment!
  • Functions can oftentimes pass their Function Environment to outer closure Languages that implement closures often can also handle inner-closures, similar to LISP. Often very expensive to implement memory-wise.

Inner vs Outer Closure

Inner Closure

The region within a function

Outer Closure

The region surrounding a function

Examples