Re: lexical scoping
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: lexical scoping
- From: "Russell Y. Webb" <rw20@...>
- Date: 2001年9月07日 14:44:08 -0700
> for k, v in tab do
> local v = v
> actors[k] = function (x) act_on(v, x) end
> end
Sounds like it'll be great. I'm looking forward to reading about it in more
detail.
k and v locals in the block enclosing these 4 lines of code, right? So I'm
a little confused as to why "local v=v" is needed.
Wouldn't v just be found as a local of the next block up and have the
correct value to be bound when actors[k] is defined? Why does it have to be
copied to the immediately enclosing block?
Russ