lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> Yes. Sorry for the noise. I had the same thought. Tail calls and
> overflowing the argument list are two different things/issues.
> 
> So while we have tail calls, this idiom *can* still result in an
> overflow.... if I understand it correctly.

You do. The call itself uses no stack space except for its arguments.

You can do something similar in Scheme:

  (define (f . x)
    (apply (f (cons 1 x))))      ; IIRC

If the implementation uses the stack to pass parameters, eventually
the list of parameters will get too large for the stack.

-- Roberto