wmb@MITCH.ENG.SUN.COM (Mitch Bradley) (02/21/91)
> Well, what about the values they (TRUE and FALSE) represent. > -1 and 0 as in FORTH-83? More precisely, TRUE is all bits set, and FALSE is all bits clear. This is indeed -1 and 0 on a 2's-complement machine, but on a ones complement or signed magnitude machine, it would be something else (maybe -0/0 on 1's complement and -maxint/0 on signed magnitude). > What's the current status of NOT? I often found it useful to define > TRUE and FALSE by > > 0 CONSTANT FALSE ( -- ff ) > FALSE NOT CONSTANT TRUE ( -- tf ) > > which works on FIG and Forth-83 Systems. As you are probably aware, it doesn't work on Forth-79 systems. ANS Forth defines the word INVERT to invert all the bits, and does not define the word NOT at all, so an application can define the word NOT to mean either "change the sense of a TRUE/FALSE flag" (as in Forth-79) or "invert each of the bits" (as in Forth-83). Mitch
UNBCIC@BRFAPESP.BITNET (02/23/91)
0 CONSTANT FALSE FALSE NOT CONSTANT TRUE I think that FALSE 0= CONSTANT TRUE makes more sense. And will always work. (8-DCS) Daniel C. Sobral UNBCIC@BRFAPESP.BITNET
rob@idacom.uucp (Rob Chapman) (02/26/91)
> 0 CONSTANT FALSE > FALSE NOT CONSTANT TRUE > I think that FALSE 0= CONSTANT TRUE makes more sense. And will always work. > Daniel C. Sobral What about an even more obvious FALSE FALSE = CONSTANT TRUE. Also an aside to the ANSI committee: If there is interest in simplifying the wordsets, wouldn't it make sense to remove (or move to an extended wordset,) the following words: 0= 0< 0> 1+ 1- 2* 2/ and possibly other words which are really a simple combination of atomic words? I understand the origins of Forth having a simple compiler and thereby putting the onus on the programmer to do the optimizing, but with the ANSI standard, a larger crowd of people will be using the language and they need not be burdened with the minor optimizations which clutter up a beautifully simple (or simply beautiful) language. They (and we) will expect these optimizations to be done by the compiler. I can see this as a new market which the vendors will have a lot of room to expand into. Rob