Content deleted Content added
→JavaScript and Java: Use original source |
→Functional: combine entries for "nested functions" and "closures" |
||
Line 109:
===Functional===
; first-class functions: [[Subroutine|Functions]] are [[first-class function|first-class]]; they are objects themselves. As such, they have properties and methods, such as <code>length</code> and <code>call()</code>;{{Sfn |Flanagan|2006| pp=137–139}} and they can be assigned to variables, passed as arguments, returned by other functions, and manipulated like any other object.{{Sfn |Flanagan|2006| p=134}} Any reference to a function allows it to be invoked using the <code>()</code> operator.{{Sfn |Flanagan|2006| p=81}}
; nested functions and closures: "Inner" or "nested" functions are functions defined within another function. They are created each time the outer function is invoked. In addition to that, each created function forms a [[Closure (computer science)|lexical closure]]: the [[Scope (programming)#Lexical scoping and dynamic scoping|lexical scope]] of the outer function, including any constants, local variables and argument values, become part of the internal state of each inner function object, even after execution of the outer function concludes.{{Sfn |Flanagan|2006| p=141}}
===Prototype-based===
|