home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!paladin.american.edu!darwin.sura.net!spool.mu.edu!olivea!charnel!fish
- From: fish@ecst.csuchico.edu (Kevin Haddock)
- Newsgroups: comp.lang.forth
- Subject: Re: Question: programming practice
- Message-ID: <1h5ojlINN9lm@charnel.ecst.csuchico.edu>
- Date: 22 Dec 92 00:47:49 GMT
- References: <BzMquL.2CE@news.iastate.edu>
- Organization: California State University, Chico
- Lines: 106
- NNTP-Posting-Host: cscihp.ecst.csuchico.edu
-
- In article <BzMquL.2CE@news.iastate.edu> bible@iastate.edu (Anthony E Bible) writes:
- >
- > I am writing a little program in which it is most reasonable to name a
- >couple of the words AND and IMMEDIATE.
- [deleted]
- > having a "bunch" of vocabulary bookkeeping stuck in the middle of
- >a word detracts from the clarity of it's function, e.g.,
- >
- > DUP FORTH-AND IF ...
- >
- > I would be interested to know how others would approach this problem,
- >or, if you think I'm just being anal retentive and this is not a problem, I'd
- >like to hear your views on that too.
-
- well if it means that much to you what you might do is create a word that
- overrides the vocabulary search order for just that following word. It would
- be somewhat specific for which ever version of forth you were using and
- if you wanted to use it to execute immediate words it would be unnecessarily
- complex. If I recollect my FIG-Forth it would go something like this:
-
- : FORTH: ( _) CONTEXT @ [COMPILE] FORTH ' CFA , CONTEXT ! ;
- IMMEDIATE
-
- I used [COMPILE] FORTH because some implimentations have made
- vocabularies IMMEDIATE. It should work for those that don't though.
-
- Now your example would be:
-
- DUP FORTH: AND IF ...
-
-
- Hope this helps,
- Kevin Haddock
- fish@cscihp.ecst.csuchico.edu
-
-
- --------
- Hackers do it with fewer instructions!
-
- Newsgroups: comp.lang.forth
- Subject: Re: Question: programming practice
- Summary:
- Expires:
- References: <BzMquL.2CE@news.iastate.edu>
- Sender:
- Followup-To:
- Distribution:
- Organization: California State University, Chico
- Keywords:
-
- In article <BzMquL.2CE@news.iastate.edu> bible@iastate.edu (Anthony E Bible) writes:
- >
- > I am writing a little program in which it is most reasonable to name a
- >couple of the words AND and IMMEDIATE. These are already defined, of course,
- >and some of the later words use the new AND while others use the FORTH AND. In
- >order to distinguish between the two I either have to switch the current
- >vocabulary temporarily to FORTH or I have to define a different word to
- >distinguish between the two. I opted to define FORTH-AND to point to FORTH's
- >AND so I could use the "clean" name for my program. I don't much care for this
- >either, but having a "bunch" of vocabulary bookkeeping stuck in the middle of
- >a word detracts from the clarity of it's function, e.g.,
- >
- > DUP FORTH-AND IF ...
- >
- >versus
- >
- >
- >
- >Hmmm. Maybe I don't need DEFINITIONS in there. Anyway, you see my point I
- >hope. I haven't written any IMMEDIATE words yet, but I may end up having some,
- >and I can scarcely immagine using more than one word for that.
- >
- >
- > I would be interested to know how others would approach this problem,
- >or, if you think I'm just being anal retentive and this is not a problem, I'd
- >like to hear your views on that too.
- >
- >Thanks.
- >
- >Regards,
- >tony
-
- well if it means that much to you what you might do is create a word that
- overrides the vocabulary search order for just that following word. It would
- be somewhat specific for which ever version of forth you were using and
- if you wanted to use it to execute immediate words it would be unnecessarily
- complex. If I recollect my FIG-Forth it would go something like this:
-
- : FORTH: ( _) CONTEXT @ [COMPILE] FORTH ' CFA , CONTEXT ! ;
- IMMEDIATE
-
- I used [COMPILE] FORTH because some implimentations have made
- vocabularies IMMEDIATE. It should work for those that don't though.
-
- Now your example would be:
-
- DUP FORTH: AND IF ...
-
-
- Hope this helps,
- Kevin Haddock
- fish@cscihp.ecst.csuchico.edu
-
-
- --------
- Hackers do it with fewer instructions!
-