organix / pijFORTHos

A bare-metal FORTH operating system for Raspberry Pi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Documentation] The TRUE value

adimiti opened this issue · comments

IMHO it is worth mentioning that in the original Jones Forth, the TRUE is 1 (not -1).

This is true, but not (IMHO) significant enough to call out explicitly. There are a number of differences between my design choices and those in Jones Forth. As I mention at the beginning of forth.md, it is common for FORTH variants to use different vocabularies and meanings.

Each dialect of FORTH has its own definitions. Development in FORTH involves extending the vocabulary with words specific to your application. Most pre-defined words in pijFORTHos follow traditional standards and conventions, but see the tables below for details.

As for the specific values of TRUE and FALSE, Jones Forth documents their own variation from the "standard" in jonesforth.s

ANS FORTH says that the comparison words should return all (binary) 1's for
TRUE and all 0's for FALSE. However this is a bit of a strange convention
so this FORTH breaks it and returns the more normal (for C programmers ...)
1 meaning TRUE and 0 meaning FALSE.

My choice was to conform with the ANS definitions, in this case.

FWIW, here's the commit (db969c6) where I changed the values for TRUE and FALSE from the original to the ANS definitions.

I am just saying that it will be good to add a note in this sense in the forth.dm . Btw I also prefer (-1) for TRUE and I am very happy to see this 'fixed'. Thanks.

Added some documentation describing the choice to use ANS definitions of TRUE and FALSE, rather than the C-like conventions in JonesForth.