2013/7/23 Stéphane Ducasse <[email protected]> > > On Jul 23, 2013, at 12:25 AM, Eliot Miranda <[email protected]> > wrote: > > > > On Mon, Jul 22, 2013 at 1:58 PM, Stéphane Ducasse < > [email protected]> wrote: > >> Hi guys >> >> I'm trying to explain the following sentence (I wrote long time ago) and >> now I'm stuck >> >> "escaping blocks jump to their home contexts but do not unwind the stack >> after this point" >> > > Seems wrong to me. ^-returns in blocks return to the sender of the home > context. > > > Yes I thought so too. I will remove this sentence because it is blurry and > wrong. I thought I was wrong. > > > >> especially I'm not clear anymore on the unwind the stack. >> > > The stack is unwound either by the VM executing the ^-return or by > MethodCOntext>>#return:, sent from #aboutToReturn:to: if the ^-return found > an intervening unwind context. (The VM sends aboutToReturn:to:). > > > Thanks > what is a intervening unwind context? >
I'm not sure I understood the question but: Unwind a context means when you return from a context to an outer one far in the stack you need to check for unwind context (= context with 'ensure:'), and execute the unwind block (= ensure: argument). For ex: context 1 context 2 context 3 (marked with primitive as unwind context) context 4 context 5 Non local return to context 1 Here the non local return in context 5 goes back to context 1 skipping the rest of the execution of the context 2 - 3 - 4. While going back to context 1 it checks every context (2, 3, 4), detects context 3 as unwindcontext and executes the unwind block of context 3 before continuing the execution in context 1. > > > > HTH > Eliot > > >> Stef >> > > > > -- > best, > Eliot > > >
