On Fri Nov 13 09:05:08 2015, jn...@jnthn.net wrote: > This ticket did uncover that there isn't a way to actually do what you > wanted, though, so we have nextcallee, which does. I've added a test > for that in S12-methods/defer-call.t. The remaining open question I've > asked (waiting for answer) is what callsame should do on an exhausted > dispatch iterator. > Larry answered that callsame/callwith returning Nil is the right thing, so those semantics stand.
> > Another interesting code snippet: > > sub foo { say 'X' }; > > &foo.wrap:{ callsame; callsame; nextsame; say 'y' }; > > foo; > > > > Which, surprisingly, prints this: > > X > > y > > > I think it's dubious that nextsame lets control go on to the say 'y' > even if the iterator is exhausted, so asked about this one too. Will > update tickets and tests with the answers. > We now will never reach that 'y' even if we don't have anywhere to go; the nextsame will call a return of Nil. Tests for these updated semantics added in S12-methods/defer-[call|next].t. /jnthn