[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: "dynamic" closures
- From: Javier Guerra <javier@...>
- Date: Mon, 30 Nov 2009 12:58:26 -0500
On Mon, Nov 30, 2009 at 12:41 PM, spir <email@example.com> wrote:
> Follow-up. Just for curiosity.
> This seems to show upvalues are referenced by names (what I called symbolic reference) rather than by address (pointer reference). Else the full replacement of t would not be seen by the closure, as its address has changed.
> Is this interpretation correct?
what i find easiest to understand, is that 't' is the_same_variable
thorough it's whole scope, not different 'pointers' to the same value.
that's what's meant by 'lexical scoping': which variables you can
access is determined by where is the code written, not when it's
executed (that's called 'dynamic scoping'). so, it doesn't matter
when g() is executed, what matters is that its code is inside the
scope of the 't' variable. therfore, it can 'see' the very same 't'