Talk:Closure (computer programming)/to do
- Introduction
- Rewrite lead paragraph (mostly done)
- In such languages a reference to a function is a reference to a closure...
- Closure = Function + Environment
- What happens when creating a closure? (Closure captures the current lexical environment)
- What happens when entering a closure? (Function is executed in the lexical environment captured by the closure)
- Picture?
- Mention all relevant terminology: open, closed, free, bound, captured, closed over
- Mention closures are an implementation technique for supporting first-class functions
- Theory: closures in operational semantics
- Add an introductory section
- Targeted primarily at imperative programmers who have little experience with non-local variables
- Closures are an implementation technique
- A form of activation record on the heap
- Compare with a stack-allocated version of activation records for nested functions
- Rewrite lead paragraph (mostly done)
- History
- Early languages:
- POP-2, POP-11; POP-11: a practical language for artificial intelligence
- PAL; 1968, 1970; http://www.softwarepreservation.org/projects/lang/PAL
- Scheme; 1975
- Early languages:
- Semantics
- Closure (computer programming)#Differences in semantics: Scheme (variables in scope) vs. Smalltalk (variables + return + self) vs, Java 7/8/... (variables + return + this + exceptions + ...)
- Capturing loop variables
- Capture by reference vs. capture by copy, extending the lifetime and garbage collection (compare C++)
- Implementation
- Luca Cardelli, Compiling a Functional Language.
- Simon Peyton Jones, Implementation of Functional Programming Languages.
- Z. Shao and A. W. Appel. Space-efficient closure representations.
- Upvalues: Roberto Ierusalimschy et al., "The Implementation of Lua 5.0"
- Funarg problems: closures are intended to solve the more difficult upwards funarg problem, but sometimes also used to solve the downwards.
- Applications: thunk (delayed computation), memoization, object system, hidden state/static variables
- Closure (computer programming)#Closures and state representation: This can be used in lazy pure languages as well, e.g. storing a memoization table in the closure which is lazyily evaluated when needed but not discarded.
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.