[comp.lang.forth] ENDIF

cbbrowne@csi.uottawa.ca (Christopher Browne (055908)) (06/14/91)

In article <60B47AF57A3F016E92@utrcgw.utc.com> RAYBRO%HOLON%UTRC@UTRCGW.UTC.COM ("William R Brohinsky", ay) writes:
>Christopher Browne writes:
>>different from the typical useage of the word "THEN" in English:
>>"If I have $50, THEN I will pay the shareware fee"
>
>Different `typical' English dialects reign in different parts of the
>world. (This is not to be construed as a slur on Canadien English:
>I grew up in Plattsburgh, and there's a lot more people who don't speak
>English very well on the southern side of that border!)

No offense taken - We're a little closer to the originators of the
"King's English here since we've only not been a colony of G.B. for
about 124 years...  Our closeness to Britain might be mistaken for
language SUPERIORITY 8^).

>In some places in the USA, I've heard:
>
>"Lessee, I got $50? Good: I can pay the Shareware, then"
>
>Maybe this is the sort of thing Charles Moore had to listen to when
>he was formulating FORTH?

    Could be...

>For what it's worth, it is quite common to rename THEN to END-IF.
>Just remember to make it fairly obvious in your code that this is what
>you are doing.

    This is a good comment on ANY non-standard features (or indeed for
many standard ones) that programmers use.

>I remember that THEN and END-IF were equivalent in some early versions
>of forth, including, if I remember, the distributed fig-forth model.

    That's right.  That was one of the things I liked about fig-forth.

    The other point I have to make about the ENDIF vs THEN question is
that when I was referring to "typical language use of THEN," I was not
merely thinking about ENGLISH useage (which most certainly can be
ambiguous, contradictory, and occasionally wrong), but also of typical
use in other COMPUTER languages.  In Pascal, FORTRAN, C, BASIC,
essentially ALL of the Algol family of languages PLUS many others, we
have the usage IF/THEN/ELSE/ENDIF (perhaps without the word ENDIF).

    In support of "THEN means (something like ENDIF)" we only have
Forth useage.

-- 
Christopher Browne
cbbrowne@csi.uottawa.ca
University of Ottawa
Master of System Science Program

dcp@world.std.com (David C. Petty) (06/23/91)

In article <1991Jun14.151508.13418@csi.uottawa.ca>,
cbbrowne@csi.uottawa.ca (Christopher Browne (055908)) writes:

`>I remember that THEN and END-IF were equivalent in some early versions
`>of forth, including, if I remember, the distributed fig-forth model.
`
`    That's right.  That was one of the things I liked about fig-forth.

In ANS Forth, include the following preamble to your code:  

: endif  ( -- )  POSTPONE THEN ;  IMMEDIATE  ( Compilation: orig -- )

You can then (or is it `endif'?) happily use ENDIF with no difference
in the compiled code.
-- 
 David C. Petty | dcp@world.std.com | ...!{uunet,bu.edu}!world!dcp /\
      POBox Two | CIS: 73607,1646   | BIX, MCIMail: dcp           /  \
 Cambridge,  MA | `Whatsoever thou doest to the tip,             /    \
02140-0001  USA |  doest thou likewise to the ring.' - RAG      /______\