[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: For loops and closures
- From: "Peter Shook" <pshook@...>
- Date: Mon, 28 Apr 2003 22:54:05 -0400
I like your proposal.
More than once, I've had the "What's the matter? Why are my closures nil?"
experience.
- Peter Shook
RLake wrote:
> I know this was brought up before (by me, amongst, I think, others) but I
> wonder if it would be possible to reopen the debate about whether
automatic
> variables in for loops are new bindings or not.
>
> It seems to me that constructions like this:
>
> for k, v in pairs(t) do
> g_bindings[k] = function(x) return g(v, x) end
> end
>
> ought to "work" (i.e. the functions that are inserted into g_bindings
ought
> to be bound to different instances of v.)