On 15 Jul, 15:22, Peter Michaux <petermich...@gmail.com> wrote:
> On Jul 15, 6:06 am, Henry <rcornf...@raindrop.co.uk> wrote:
>
>
>
> > On Jul 15, 1:47 pm, seani wrote:
>
> > > Peter Michaux wrote:
> > <snip>
> > >> function foo() {
> > >> * // do stuff
> > >> * // ...
>
> > >> * // make a delayed recursive call to foo
> > >> * setTimeout(foo, 3000);
> > >> }
> > <snip>
> > > A tiny point of order / question: the call to setTimeout
> > > isn't actually recursive here, is it?
>
> > No it is not.
>
> If we are nit picking, foo is defined in terms of itself so it is a
> recursively defined function. It does not evolve a recursive process,
> however, as the return path is not growing with each call to foo in
> the cycle.
>
Well, nitpicking wasn't the intention
I've used setTimeout in exactly the manner suggested for a number or
reasons and wanted to be certain I wasn't missing some behaviour that
would catch me out in long-running / short timeout scenarios.
But to give nitpicking a spin for a bit, I didn't refer to the
definition of foo itself, but explicitly to the nature of the call in
the body of the function. These seem like different things to me, but
is that ignorance on my part (always a fair bet).