wmb@sun.uucp (Mitch Bradley) (07/19/84)
My recent posting describing QUAN's and TO variables generated a lot of mail response, so I'll follow up by posting a list of references. Briefly, QUAN's, or more generally, Multiple Code Field words, are words which have several behaviors, depending on a word which precedes them. The particular behavior is selected at compile time: Examples: A QUAN is sort of like a variable. QUAN FOO defines FOO as a QUAN FOO leaves the value of FOO on the stack 47 TO FOO stores 47 into FOO AT FOO leaves the parameter field address of FOO on the stack A VECT is sort of like an execution variable (or execution vector or deferred word). VECT FOO defines FOO as a VECT FOO executes the word associated with FOO ' EMIT TO FOO associates the word EMIT with FOO AT FOO leaves the parameter field address of FOO on the stack The word IS has been proposed as an alternative to TO because TO is difficult to distinguish from the number 2 when talking to someone. Several very good papers about Multiple Code Field words are to be found in Volume 1, No. 2 of The Journal of Forth Application and Research. I believe that this issue is still available; write to "Journal of Forth Application and Research", Box 27686, Rochester, NY 14627. For historical background, see P. Bartholdi, "The TO solution" and "TO solution continued", FORTH Dimensions, Vol. 1, Nos. 4 and 5, 1979. G.B. Lyons, "Note on the TO solution", FORTH Dimensions, Vol. 1, No. 5, 1980 E. Rosen, "High Speed, Low Memory Consumption Structures", Proceedings FORML Conference 1982. W. Ragsdale, "A New Syntax for Defining Defining Words", Proceedings FORML Conference 1980, p. 122 In particular, I recommend the "Journal" issue and the Rosen paper. I'm not sure who first realized that Multiple Code Field words are similar in concept to "objects", but several people at the recent Rochester Forth Convention seemed to have hit upon the notion. This notion is ripe for exploitation right now. Please let me know if you do anything with it. Mitch Bradley