[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: named-let
From: |
Stefan Monnier |
Subject: |
Re: named-let |
Date: |
Mon, 11 Jan 2021 18:57:36 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
>> [ TCO has also undesirable interactions with debugging/tracing, but
>> I think that would be a secondary concern which should be
>> manageable somehow. ]
>
> It's also a change in semantic as one must assume that `bar' is not
> redefining `foo'.
>
> (defun foo ()
> (bar)
> (foo))
I think there's a bit of confusion: you can have TCO without having to
pay any attention to whether `bar` changes `foo`. True TCO will also
avoid eating up stack space when you have code like
(defun foo (x)
(baz (1+ x)))
or
(defun foo (x)
(funcall (if (something) #'bar #'foo) (1+ x)))
or
(defun foo (x)
(let ((k (lambda (y) (foo (1+ x)))))
(k 5)))
or ... and that doesn't depend on analyzing the code at all.
IOW, it shouldn't matter whether it's a recursive call or whether it's
a call to "self": all calls in tail position would conceptually pop
their stack frame before jumping to the destination function.
Stefan
- Re: named-let, (continued)
- Re: named-let, Tomas Hlavaty, 2021/01/09
Re: named-let, Zhu Zihao, 2021/01/10
- Re: named-let, Tomas Hlavaty, 2021/01/11
- Re: named-let, Stefan Monnier, 2021/01/11
- Re: named-let, Tomas Hlavaty, 2021/01/11
- Re: named-let, Andrea Corallo, 2021/01/11
- Re: named-let, Stefan Monnier, 2021/01/11
- Re: named-let, Andrea Corallo, 2021/01/11
- Re: named-let,
Stefan Monnier <=
- Re: named-let, Andrea Corallo, 2021/01/12
- Re: named-let, Stefan Monnier, 2021/01/12
- Re: named-let, Andrea Corallo, 2021/01/12
Re: named-let, Helmut Eller, 2021/01/12
Re: named-let, Zhu Zihao, 2021/01/13
Re: named-let, Stefan Monnier, 2021/01/13
Re: named-let, Andrea Corallo, 2021/01/11
Re: named-let, Tomas Hlavaty, 2021/01/11
Re: named-let, Andrea Corallo, 2021/01/11
Re: named-let, Tomas Hlavaty, 2021/01/11