Interesting discussion, thank you. I'm still unclear, though, what exactly makes infinite recursion work when recursive call is wrapped in setImmediate. What happens to the stack?
On Friday, November 8, 2013 5:41:03 PM UTC-5, Rick Waldron wrote: > > > https://github.com/joyent/node/issues/5798 > > On Fri, Nov 8, 2013 at 5:38 PM, Ilya Shaisultanov > <[email protected]<javascript:> > > wrote: > >> No worries. >> >> Is the bug that it doesn't throw RangeError or that the execution happens >> in background? >> >> On Friday, November 8, 2013 5:31:45 PM UTC-5, Rick Waldron wrote: >>> >>> >>> >>> >>> On Fri, Nov 8, 2013 at 5:29 PM, Ilya Shaisultanov <[email protected] >>> > wrote: >>> >>>> Ok, I think I'm thinking about process.nextTick as it was in node >>>> <0.10, where, if I'm not mistaken >>>> >>>> function f() { >>>> process.nextTick(f) >>>> } >>>> >>>> f() >>>> >>>> would loop infinitely, whereas an immediate recursive call throws >>>> RangeError. >>>> >>>> I tried running that in v0.10 and got RangeError. However, >>>> >>>> function f() { >>>> setImmediate(f) >>>> } >>>> >>>> f() >>>> >>>> puts the function in "background" and makes node process consume 100% >>>> CPU. What happens there? >>>> >>> >>> >>> I believe this is a bug that's specific to 0.10.x and was fixed in >>> 0.11.x and up. (Sorry, I don't have free cycles to look up the relevant >>> github issues at the moment) >>> >>> Rick >>> >>> >>>> On Friday, November 8, 2013 5:20:21 PM UTC-5, Rick Waldron wrote: >>>> >>>>> >>>>> >>>>> >>>>> On Fri, Nov 8, 2013 at 3:57 PM, Ilya Shaisultanov < >>>>> [email protected]> wrote: >>>>> >>>>>> Pardon for resurrecting such old thread but I have a question about >>>>>> process.nextTick: why/how does it eliminate the current stack? What >>>>>> happens >>>>>> behind the scenes? >>>>>> >>>>> >>>>> It doesn't eliminate the current stack. The callback is "scheduled" >>>>> and subsequently executed in the next execution turn. >>>>> >>>>> Rick >>>>> >>>>> >>>>> -- >>>> -- >>>> Job Board: http://jobs.nodejs.org/ >>>> Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List- >>>> Posting-Guidelines >>>> You received this message because you are subscribed to the Google >>>> Groups "nodejs" group. >>>> To post to this group, send email to [email protected] >>>> >>>> To unsubscribe from this group, send email to >>>> [email protected] >>>> >>>> For more options, visit this group at >>>> http://groups.google.com/group/nodejs?hl=en?hl=en >>>> >>>> --- >>>> You received this message because you are subscribed to the Google >>>> Groups "nodejs" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> >>>> For more options, visit https://groups.google.com/groups/opt_out. >>>> >>> >>> -- >> -- >> Job Board: http://jobs.nodejs.org/ >> Posting guidelines: >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >> You received this message because you are subscribed to the Google >> Groups "nodejs" group. >> To post to this group, send email to [email protected]<javascript:> >> To unsubscribe from this group, send email to >> [email protected] <javascript:> >> For more options, visit this group at >> http://groups.google.com/group/nodejs?hl=en?hl=en >> >> --- >> You received this message because you are subscribed to the Google Groups >> "nodejs" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
