why new_pad *INT*?

2003-08-14 Thread Michal Wallace
Hey all, I'm just starting to get into using pads, and I'm not sure I understand new_pad. Specifically, why does it take an int? It seems to me, that 9 times out of 10, you're going to want to create a new pad at the next lower depth than the one before. So, two questions: 1. Should there b

Re: why new_pad *INT*?

2003-08-14 Thread Sean O'Rourke
Michal Wallace <[EMAIL PROTECTED]> writes: > Okay, I definitely need some help understanding this. Okay, I definitely did a suboptimal job trying to clarify... > Here's some python code that defines a closure: > > def make_adder(base): > def adder(x): >

Re: why new_pad *INT*?

2003-08-10 Thread Michal Wallace
On Sat, 9 Aug 2003, Sean O'Rourke wrote: > The problem is that when adder() gets returned, it > needs to remember the enclosing pad. So this needs to > be > > newsub $P1, .Closure, _sub1 > > which (IIRC) will save the lexical environment in which > it was created (see closure.pmc), then res

Re: why new_pad *INT*?

2003-08-10 Thread Sean O'Rourke
Michal Wallace <[EMAIL PROTECTED]> writes: > 1. Should there be a new_pad that takes > no arguments to do this, so we don't > have to keep count manually? > > 2. When would you NOT want to use > new_pad (current_depth+1) ? Remember, the pad depth reflects lexical scope nesting, no

Re: why new_pad *INT*?

2003-08-09 Thread Michal Wallace
On Sat, 9 Aug 2003, Sean O'Rourke wrote: > Remember, the pad depth reflects lexical scope nesting, > not dynamic scoping. So if you mean "current_depth" as > "current compile-time depth" above, then you're right, > but the VM would have no way to tell. If you mean > run-time depth, which the com