Closures/Value capture: Difference between revisions
Content added Content deleted
imported>Rowsety Moid |
imported>Rowsety Moid |
||
Line 53: | Line 53: | ||
calls the function represented by that lambda-expression. Since it does not give the function any arguments, <code>a</code> and <code>b</code> get their default values (which are the values captured by <code>freeze</code>). |
calls the function represented by that lambda-expression. Since it does not give the function any arguments, <code>a</code> and <code>b</code> get their default values (which are the values captured by <code>freeze</code>). |
||
(Although code within such a 'closure' can assign new values to the captured variables, it would have only a temporary effect and would not change the values seen in subsequent calls to the same closure. That's one sense in which the variable values are "frozen".) |
|||
Here is the definition of <code>freeze</code>: |
Here is the definition of <code>freeze</code>: |