Re: [stack] disallowing recursive definitions
"William Tanksley, Jr" <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
John Cowan <[email protected]> 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. Knuth seemed to see more use for it than that. But I grant your point, and I wouldn't want to be _against_ Dijkstra on any point, anyhow. > > 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. That feels questionable to me. GOTOs can be conditional, and tags can be inside conditions as well. In short and to be formal, it seems to me that tagbodies don't form properly nested trees, as functions must... I think they form digraphs. I hesitate to pronounce strongly on this, because I haven't studied it, and you clearly have. But perhaps if I make my mistake out loud you can correct me. :-) > "Lambda: the ultimate GOTO." An interesting point. A recursive tail call in an applicative language can do one thing that a simple GOTO cannot: it can, at one stroke, change the value of all the parameters of the function to something else. This would certainly be sufficient to make an applicative theorist blanch... > Well, I have news for our current leaders John Cowan -Wm