![]() | |
![]() |
| | Thread Tools | Display Modes |
#21
| |||
| |||
|
|
On May 18, 2:16 am, Thomas 'PointedEars' Lahn <PointedE... (AT) web (DOT) de wrote: A recursive algorithm does not *close back* *on* itself, it *calls forward* *to* itself. Hence the requirement of a stack for recursion, but not for iteration. OK, let's us set the grounds first: iterations, recursions, finite loops, infinite loops etc. these are all top level mental constructs used in the programming to distinguish certain types of top level coding. On the engine level itself there is the stack, its size and respectively certain amount of RET values it may store in LIFO schema. Respectively the engine itself doesn't care what RETs are these: function F0001 calling F0002,... calling F1000 - or the same function F calling itself 1000 times. It is all the same by the allocation demands. |
#22
| |||
| |||
|
|
No, it is not. With recursion it is a different execution context than iteration, and therefore the allocation demands must be quite different. Besides, arguing with assembler when we know that we are dealing with a Virtual Machine, and using eval() for testing recursion, shows again what little your long-winded "explanations", flawed "tests", and bloated "examples" are worth. |
#23
| |||
| |||
|
|
Jeff Bigham <jeffrey.big... (AT) gmail (DOT) com> writes: |
|
Is recursion not a viable option in Javascript? As viable as in any other *language* - i.e., limited by the implementation and/or platform that it runs under. Javascript in web pages just has the extra problem that the author doesn't get to pick the language implementation. |
#24
| |||
| |||
|
|
So, it appears that Javascript has a recursion limit of about 1000 levels on FF, maybe less/more on other browsers. |
function f(p){document.write(p+'<br>'); f(p+1); })(0)
#25
| |||
| |||
|
|
Jeff Bigham wrote: So, it appears that Javascript has a recursion limit of about 1000 levels on FF, maybe less/more on other browsers. javascript function f(p){document.write(p+'<br>'); f(p+1); })(0)WebKit/Safari r33029 --> 139808 FF3.0pre --> 2999 |
|
IE8.0.6001 --> 2340 |
#26
| |||
| |||
|
|
IE 7.0.5730.11 --> 2507 |
#27
| |||
| |||
|
|
Jorge wrote: Jeff Bigham wrote: So, it appears that Javascript has a recursion limit of about 1000 levels on FF, maybe less/more on other browsers. javascript function f(p){document.write(p+'<br>'); f(p+1); })(0)IE 7.0.5730.11 --> 2507 |
#28
| |||
| |||
|
|
Thomas 'PointedEars' Lahn wrote on 23 mei 2008 in comp.lang.javascript: IE 7.0.5730.11 --> 2507 Mine (IE 7.0.5730.11 under XP) does 2553 ==================== function f(p){ if (!(p%500)||p>2550) document.write(p+'<br>'); f(p+1);}; f(0); |
#29
| |||
| |||
|
|
On May 23, 11:29 am, "Evertjan." <exjxw.hannivo... (AT) interxnl (DOT) net wrote: Thomas 'PointedEars' Lahn wrote on 23 mei 2008 in comp.lang.javascript: IE 7.0.5730.11 --> 2507 Mine (IE 7.0.5730.11 under XP) does 2553 ==================== function f(p){ if (!(p%500)||p>2550) document.write(p+'<br>'); f(p+1);}; f(0); document.write method is implemented as a pipe so useless for stack studies. |
#30
| |||
| |||
|
|
VK wrote on 24 mei 2008 in comp.lang.javascript: On May 23, 11:29 am, "Evertjan." <exjxw.hannivo... (AT) interxnl (DOT) net wrote: Thomas 'PointedEars' Lahn wrote on 23 mei 2008 in comp.lang.javascript: IE 7.0.5730.11 --> 2507 Mine (IE 7.0.5730.11 under XP) does 2553 ==================== function f(p){ if (!(p%500)||p>2550) document.write(p+'<br>'); f(p+1);}; f(0); document.write method is implemented as a pipe so useless for stack studies. I don't see why. Please explain. |
![]() |
| Thread Tools | |
| Display Modes | |
| |