|
On 23/10/2012 23:19, Coda Highland wrote:
On Tue, Oct 23, 2012 at 2:15 PM, Javier Guerra Giraldez <javier@guerrag.com> wrote:On Tue, Oct 23, 2012 at 2:46 PM, spir <denis.spir@gmail.com> wrote:Yes, thank you very much. I knew of such uses of closures, actually, but had not yet realised they require the variable, not the data, to be recorded with the func.personally, i wouldn't call a function 'closure' if it doesn't enclose external variables like that. in fact, i don't consider a language has lexical scoping unless it implements real closures.Then you would be wrong. :P You can still consider it a closure if it COPIES the scope instead of REFERENCES it. The ability to modify the state of a closure after it's created isn't a requirement to the definition of a closure.
Sure. And: y = x+1 there x+1 is a closure, if x is a variable -- I mean if it's not a constant. One problably would *not* wish y to change when x later changes. Or?(The case of funcs allows another behaviour because in addition to beeing defined, they're later executed; a kind of re-pass. For y, there's only one, unless definitions are executed just-on-time, here when we need y's data for something else.)
In maths, there's no time, things are easier ;-) (to reason) denis