Re: Little fun with vararg
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Little fun with vararg
- From: Roberto Ierusalimschy <roberto@...>
- Date: Tue, 5 Aug 2014 15:01:40 -0300
> 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