[comp.lang.forth] Category 10, Topic 16

ForthNet@willett.UUCP (ForthNet articles from GEnie) (01/06/90)

Category 10,  Topic 16
Message 83        Sun Dec 24, 1989
R.BERKEY [Robert]            at 09:06 PST


 Roedy Green writes:

 RG> 7.0610  ?DO
 RG>     You might consider changing the definition to match
 RG>     Ray Duncan's so that -LOOP works too.


I agree.

(1)   The ?DO 's that I know of all have the same definition.  It's a
fundamental definition, which, for example, appears in the 8086 REP opcode.

(2) The BASIS ?DO is easy to code in high level with the conventional ?DO :

   ... OVER MIN ?DO ...

while there is no way to implement a conventional ?DO with the BASIS ?DO .

(3) The justification given for a new ?DO is itself outside the scope of a
Standard Program:  that during development, getting the parameters backwards
leads to pushing the reset button.  I don't see this as substantive: it only
happens to me a few times a year, and many programmers have an interrupt
function that obviates the need for a reset even then.

(4) Adding the new ?DO to existing code with the conventional ?DO requires
either analysis of compatibility for all cases, or finding a new name for ?DO
.  Why find a new name and change existing code, when the new function can be
the one with a new name?

---

The BASIS ?DO is incompatible with existing ?DO 's in that THEN must be added
after LOOP :

   ?DO ... LOOP THEN

Suppose BASIS restores a conventional definition for the runtime of ?DO . 
Does this compilation change warrant a new name for ?DO ?  I'm inclined to say
no.


What are other opinions?  And name preferences or suggestions?

-----
This message came from GEnie via willett through a semi-automated program.
Report problems to: 'uunet!willett!dwp' or 'willett!dwp@gateway.sei.cmu.edu'

ForthNet@willett.UUCP (ForthNet articles from GEnie) (01/06/90)

Category 10,  Topic 16
Message 84        Sun Dec 24, 1989
R.BERKEY [Robert]            at 09:08 PST

  To: Roedy Green

 RG> 7.1760  LEAVE
 RG>     If leave is used in a colon definition NOT in a loop, will
 RG>     this exit the current loop in the caller?

Hmmm, LEAVE refers to "compilation semantics" needing "loop control
parameters".  Yet DO indicates that there are "loop control parameters" for
the "interpretation semantics".  Another note, the compiling stack for DO is
backwards.

  RG>    If not, it sure would be nice to have a way of putting the
  RG>    code for the guts of a loop into a separate definition,
  RG>    with access to a LEAVE mechanism.

Yes, but how?   It would be nice to access the index from called words, too.

Agape, Robert

-----
This message came from GEnie via willett through a semi-automated program.
Report problems to: 'uunet!willett!dwp' or 'willett!dwp@gateway.sei.cmu.edu'