[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Visibility and upvalues (and macros)
- From: Dave Bollinger <DBollinger@...>
- Date: Thu, 29 Jul 1999 00:40:47 -0400
>> the "enclosing" scope might no longer exist when the function is
executed.
Aha! It might be executed outside the scope where it was defined. Duh!
Thanks, I think that helped. :-)
I've become real comfortable with upvalues as backwards references to
overridden functions, but have stopped at about that point. It seems
then, if I'm on the right track now, that one of the neat "tricks" with
upvalues is using a function to return a newly created function which uses
upvalues - and since it's newly created, the upvalues are "current". So
each time you call the "creator" function it could return a different
function based on the current value of the thing referenced by the upvalue.
I need to revisit the factorial.lua test code. I remember going around
in circles trying to figure that one out! <grin> Is this type of "trick"
what you were intending to demonstrate there?
Cheers,
Dave