Question: programming practice 
Author Message
 Question: programming practice

        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

        DUP FORTH AND MYVOC DEFINITIONS IF ...

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 {*filter*}retentive and this is not a problem, I'd
like to hear your views on that too.

Thanks.

Regards,
tony



Sat, 10 Jun 1995 06:08:42 GMT  
 Question: programming practice

Quote:

>    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 {*filter*}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:


   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

--------
Hackers do it with fewer instructions!

Newsgroups: comp.lang.forth
Subject: Re: Question: programming practice
Summary:
Expires:

Sender:
Followup-To:
Distribution:
Organization: California State University, Chico
Keywords:


Quote:

>    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 {*filter*}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:


   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

--------
Hackers do it with fewer instructions!



Sat, 10 Jun 1995 08:47:49 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Programming practice question

2. eXtreme Programming Chrysler Comprehensive Compensation Practices

3. Theory and Practice of Object-Oriented Programming Seminars

4. INI Files - Good Programming Practices

5. Is using multiple EXITs bad programming practice?

6. Functional Programming (Practice and Theory) by Bruce J. MacLennan

7. Postdoctoral position: THEORY AND PRACTICE OF PROGRAMMING LANGUAGES

8. Position in theory and practice of programming languages

9. Postdoctoral position: THEORY AND PRACTICE OF PROGRAMMING LANGUAGES

10. Position in theory and practice of programming languages

11. CFP: First Workshop on Principles and Practice of Constraint Programming

12. CFP: Workshop on Principles and Practice of Constraint Programming

 

 
Powered by phpBB® Forum Software