Forth

Holonforth started with Forth. Forth provided the fundamental ingredients and concepts.

Words

In Forth every program element that has a name (ID) is a word. Existing words define new words with a simple concatenation. All words (procedures, variables, objects) are on equal standing, you simply line them up. The trick is to pass arguments and results on a stack.

Thus a program is a collection of words. This is general, applies to all modular programming languages. A program is a collection of (named) program units.

Blocks

Blocks are an alternative to files for storing and handling source code. The storage medium is divided into equal sized chunks, usually 1024 bytes, that are addressed by an index. There is space for several short Forth definitions, say a group of related functions. But not all definitions are small. I found that blocks are best used with one word per block.

One Word per Block

With one word per block (OWPB) you have ample space for the definition and a comment. And it is easy to rearrange words in the program: move the block. I tested the concept in my next project at the time with a little extension to the blocks editor to shift blocks around in the block list. The block list defines the loading sequence of the blocks.

Dictionary

In the Forth dictionary each word entry includes a link to its definition. This is handy to look up word definitions with SEE or VIEW. But the dictionary is built by the compiler and only exists for loaded words. Thus we cannot used this nice facility of Forth during the initial phases of development, when the words are not yet ready for loading. I certainly like to jump around in the code in the development phase.

Editor builds Dictionary

With OWPB you can create a dictionary header together with a new word block. The header includes everything but the code link; the code is inserted later by the compiler when the block is loaded. The text link is the block number which remains valid independent of its position in the block list.

Database

This now looks very much like a database where the blocks are the records. It is.