From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID, LOTS_OF_MONEY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,9a0ff0bffdf63657 X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,4b06f8f15f01a568 X-Google-Attributes: gid103376,public X-Google-Thread: f43e6,9a0ff0bffdf63657 X-Google-Attributes: gidf43e6,public X-Google-Thread: 1108a1,9a0ff0bffdf63657 X-Google-Attributes: gid1108a1,public From: eachus@spectre.mitre.org (Robert I. Eachus) Subject: Optimizing recursion (was Re: Why C++ is successful) Date: 1998/08/25 Message-ID: #1/1 X-Deja-AN: 384677509 References: <6qfhri$gs7$1@nnrp1.dejanews.com> <35cb8058.645630787@news.ne.mediaone.net> <902934874.2099.0.nnrp-10.c246a717@news.demon.co.uk> Organization: The Mitre Corp., Bedford, MA. Newsgroups: comp.lang.eiffel,comp.object,comp.software-eng,comp.lang.ada Date: 1998-08-25T00:00:00+00:00 List-Id: In article Patrick Logan writes: > Another approach is to use a compiler that can eliminate tail > recursive stack growth. If function A returns the result of function > B, then there is no need to increase the stack only to pop it when the > call is done. The result is a procedure call can be compiled as > efficiently as a GOTO. Scheme is defined this way. All iterations can > be defined in terms of procedures.... While tail recursion is an optimization that any good compiler should try to do, that again misses the point. In Ada you often decompose your program into several layers of abstraction, resulting in lots of small subroutines which often contain only one executable statement. Pragma Inline is a way of telling the compiler that this abstraction is really for the author or reader of the code, and that the compiled code should ignore the separation. To the greatest extent possible, the goal in Ada is to make the code understandable to the reader. Pragma Inline is one tool for creating an abstraction without having to pay for it at run-time. -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...