[stack] Re: disallowing recursive definitions
Stan Katz <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
Manfred von Thun wrote :
> This encourages me to ask a question about Forth which I have been
> too shy to ask. I¹ve read a number of times that recursion was not
> allowed or not easy to do at least in the earlier versions of
> Forth. I explained this to myself like this: the colon definitions are
> just macros, and the macro expansion is very simple.
>
> Was I right about the early Forths? Was is the current situation?
Recursion has always been available in Forth, but it needed some care because
most implementations "hide" the current definition until it is complete. This was
done so that it was possible to re-define a word and use the old definition within
the new word, e.g. to add additional processing or checking to the operation, and
possibly also to prevent a word that was not completely defined (or had an error
while it was defined) from being used.
Many Forths included the word RECURSE or MYSELF for recusrion and those that
didn't have it as a standard word usually had it as an extension.
There has actually been a discussion recently on the comp.lang.forth usenet
newsgroup about this hiding of the current definition.
Stan Katz
---------------------------------
Looking for last minute shopping deals? Find them fast with Yahoo! Search.
[Non-text portions of this message have been removed]