Next: , Previous: Notation, Up: Words

5.2 Case insensitivity

Gforth is case-insensitive; you can enter definitions and invoke Standard words using upper, lower or mixed case (however, see Implementation-defined options).

ANS Forth only requires implementations to recognise Standard words when they are typed entirely in upper case. Therefore, a Standard program must use upper case for all Standard words. You can use whatever case you like for words that you define, but in a Standard program you have to use the words in the same case that you defined them.

Gforth supports case sensitivity through tables (case-sensitive wordlists, see Word Lists).

Two people have asked how to convert Gforth to be case-sensitive; while we think this is a bad idea, you can change all wordlists into tables like this:

     ' table-find forth-wordlist wordlist-map  !

Note that you now have to type the predefined words in the same case that we defined them, which are varying. You may want to convert them to your favourite case before doing this operation (I won't explain how, because if you are even contemplating doing this, you'd better have enough knowledge of Forth systems to know this already).