6.16.1 Vocabularies

Here is an example of creating and using a new wordlist using Standard Forth words:

wordlist constant my-new-words-wordlist
: my-new-words get-order nip my-new-words-wordlist swap set-order ;

\ add it to the search order
also my-new-words

\ alternatively, add it to the search order and make it
\ the compilation word list
also my-new-words definitions
\ type "order" to see the problem

The problem with this example is that order has no way to associate the name my-new-words with the wid of the word list (in Gforth, order and vocs will display ??? for a wid that has no associated name). There is no Standard way of associating a name with a wid.

In Gforth, this example can be re-coded using vocabulary, which associates a name with a wid:

vocabulary my-new-words

\ add it to the search order
also my-new-words

\ alternatively, add it to the search order and make it
\ the compilation word list
my-new-words definitions
\ type "order" to see that the problem is solved