[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tail recursion, again
Date: Mon, 10 Sep 90 11:53 CDT
From: email@example.com (William D. Gooch)
Personally, I would prefer that Symbolics not expend any of its limited
resources on developing such things as tail-recursion optimization at
this point, even if it were practical in a technical sense to do so. I
would rather they stay in business by concentrating on issues that will
pay off by serving the needs of large set of customers instead, even if
that implies a degree of sacrifice for the little guys like me and you.
I agree with this viewpoint. I also would like to point
out that many (but not all) of the people arguing for
tail recursion optimization have missed the point that
this is an OPTIMIZATION, and inherently optional, and
that unbridled, unbounded-depth recursion is a bug in
your program that should be fixed by using a more
appropriate algorithm, not by complaining about the
lack of this optimization.
Tail recursion optimization is NOT part of the language.
I'm not saying that lsmith was making this mistake; it IS
reasonable to want tail-recursion optimization to avoid
unnecessary depth, and also improve average function calling
speed. But you pay a serious cost in debuggability as a result,
and because of various low-level issues in various
implementations (including generic functions), it is difficult to
predict just when tail-recursion optimization is possible and
Summary: You should NEVER code your program to depend on
tail-recursion elimination, and you should set the size
of your stack accordingly.