> To my mind the callback runs and as part of its functionality schedules itself for later execution, it doesn't invoke itself directly as 'classical' recursion.
This much is correct, i.e., you're only creating a closure once, and all calls to it except for the first are coming from the event loop (i.e., each time the write buffer is emptied, the callback is invoked). However there is still recursion in the sense that the function is referenced from within its own body, which means there's a loop of pointers ($cb refers to the sub and the sub refers to $cb) that the reference-counting garbage collector will never free up unless you do something to break it explicitly.(weaken($cb) but do it *after* that first call.) On Wednesday, June 10, 2015 at 7:47:11 PM UTC-7, Allan Cochrane wrote: > > Hi, > > just nit-picking here but since the callbacks do not actually invoke > themselves is it really recursion? > > To my mind the callback runs and as part of its functionality schedules > itself for later execution, it doesn't invoke itself directly as > 'classical' recursion. > > Can anyone explain where my thinking has gone wrong? > > Allan > -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
