Design errors allowed by the ANS Forth (aka ISO Forth) standard

by Michael L. Gassanenko

The ANSI/ISO Forth standard does not require the developer to avoid a number of design mistakes. Here is a short (and incomplete) list of features/bugs that contradict to common sense but not to the ANS Forth standard.

This is a menagery of rakes lurking in the grass and waiting for their prey to step on them ;-).

  1. The standard does not require that BL WORD and the text interpreter process characters less than 32 in the same manner. That is, the built-in text interpreter may treat tabs as whitespace while BL WORD is allowed to consider tabs as letters.
  2. The standard does not require that EMIT and TYPE process the characters less than 32 in the same manner. That is, in the following example
    CREATE CRLF 13 C, 10 C,
    CRLF 2 TYPE
    13 EMIT 10 EMIT
    
    CRLF 2 TYPE is not required to produce the same result as 13 EMIT 10 EMIT.
  3. Some words, in particular, i/o-related words, return error codes. It is interesting to note that the circumstances under which they may return error codes are ambiguous conditions, that is, these words are allowed not to return non-zero error codes but to THROW an error, or perform ABORT, or "take implementation-dependent actions" (that is, do anything else).

If you know any more such things, please, send them to me, mlg[at]forth[dot]org.