Re: [stack] language hierarchy
"William Tanksley, Jr" <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
Don Groves <[email protected]> wrote: > John Nowak wrote: > > This has the downside that functions cannot make use of explicit > > recursion (as hypot isn't defined until def is called, and hence the > > quote can't make use of it), but this restriction is in place anyway > > due to the type system. > How about "self" as a call to its enclosing context? It won't work for dynamic definitions, because there's no distinct concept of "enclosing context". All you know is that you're inside a quotation that's inside another quotation; you can't look ahead to see which enclosure is the one being defined and/or executed. There are several solutions: 1. Provide special syntax for quoted definitions (perhaps make them compiled). 2. Provide recursion primitives like linrec, genrec, etc. 3. Provide partial continuations. #3 is especially interesting, since PCs can implement recursion or backtracking equally easily. In a typefree language, it's very simple to implement; in a typechecked language, of course, one additionally has to ensure that the word which begins the partial continuation is exposed to the same stack as the words which call it. > Don -Wm