https://ko.wikipedia.org/wiki/일급_객체
(cited from fluent python , 311)
Record of a Function: The closure is essentially a record (or a snapshot) that stores a function along with its environment. The variables of the enclosing scope are packaged with the function, which allows the function to access those variables even after the outer function has finished execution.
함수의 레코드 : 클로저는 본질적으로 레코드(거나 스냅숏이다) 함수를 그 환경변수로서 보존하는..이 스코프 속에 변수들은 함수와 함께 패키징 되어서, 함수가 이 변수에 그 함수 실행이 끝난 시점에까지도 접근 가능하게 해준다.
A closure in programming is not just a function or just a scope—it is actually a combination of both. It fundamentally consists of a function bundled together with a referencing environment for the free variables necessary to support that function. Here’s how that breaks down:
The core of a closure is a function—it has parameters and a body, just like any typical function you might define. What differentiates a closure functionally is its ability to access variables that are not passed in as parameters but are instead captured from the surrounding scope where the closure was defined.
The other crucial component of a closure is the referencing environment (or the closure's "scope"). This environment includes any local variables that were in-scope at the time the closure was created and which are used within the closure. This environment travels with the closure, meaning that the closure can be executed in a different context (e.g., in another function or as a callback) and still retain access to these captured variables.