On Sat, Jul 26, 2008 at 8:27 AM, Edward Heil <[EMAIL PROTECTED]> wrote: > Oh, probably the reason every click says "10" there is that there is only > one variable i, it's defined outside the "map", and it gets mutated up to > 10. Speaking in terms of closures, all the handlers "close over" that one > single variable binding, they don't each "close over" their own variable > binding, because there only is one. To get the latter you'd need to have a > variable whose scope is equal to the map.
Hm - you're right, I was misunderstanding the way closures and variable scopes interacted. > I'm not sure you should be using a map there. Maybe just a foreach would > do? An each_with_index would give you e and i, and they'd be block-scoped > like you want. > > I'm not sure what the "append do" is doing in the main stack? You don't > need to append when you first lay out the app, just if you're modifying it > later on. Another misconception - I was thinking of the method call as returning an array of 10 flows, which could then be appended into the main stack. martin
