Re: [stack] disallowing recursive definitions
"Joe Bowbeer" <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Feb 29, 2008 at 5:36 AM, John Cowan wrote: > William Tanksley, Jr scripsit: > > > I'm generally on Knuth's side on this one. > > Remember that Knuth thought Dijkstra was *mostly* right, and takes care to > disclaim the notion that he is in favor of random gotos. AFAIK, gotos are > only used in TeX to compensate for Pascal's lack of a return statement. > > > But I don't see how tail recursion is a general goto statement. It > > seems structured -- in particular, a tail recursion has only one entry > > point. > > If you take an arbitrary tagbody (a list of statements and labels with > gotos embedded in the statements), you can restructure it into a sequence > of functions, one per label, where each function ends by tail calling the > next function in sequence (corresponding to flowing through the label) > and each goto is changed into a tail call. This can be done entirely as > a local transformation. > > So while it's true that tail calls have only one entry point, entry > points and labels are basically the same thing from a Scheme perspective, > something that neither Knuth nor Dijkstra deals with. "Lambda: the > ultimate GOTO." > > I would say, rather: "continuations: the ultimate goto". And I would mean that in a good way:) What you're describing is an equivalence between gotos and a sequence of function calls, something which is not 100% possible without support for recursion, and something which is not 100% efficient without tail-call optimization, but I can't see how you can twist this around to indict recursion. I do sort of see, now, how the anaphoric (from hell?) quality of stack programming languages does provide a lot of expressive power without the need to resort to recursion. --Joe [Non-text portions of this message have been removed]