What is Forth?
Why use Forth?
Why use Forth?
A brief list of the advantages of using Forth are:
the code produced is fast - usually about 50% of the speed of hand-crafted assembler and at least 10x faster than Basic
- a Forth macroassembler can be used for time-critical code (see examples in 'Downloads' section)
- compact memory requirements - no bloatware here!
- unrestricted low-level access to hardware/peripherals, so ideal for the Raspberry PI
- Great flexibility to extend the language - new data types easily defined (eg complex numbers, vectors, records, lists , N-dimensional arrays etc) - using CREATE aand DOES> , described as "the jewel of Forth"
- uses a LIFO data stack to pass variables, so that fewer defined variables and constants are needed (equivalent to LOCAL variables)
- Code is written as a list of existing words in plain text and are compiled (added) into an existing dictionary of other words at run time
- multi-tasking ability similar to RiscOS (i.e. co-operative system), but distinct from it and easy to use. Other multi-tasking systems may also be used, depending on the application.
Forth provides an interactive programming environment (with both interpretive and compiled features) and is designed for those people who wish to write their own programs.
Some of the possible disadvantages are:
- "Write-only" code. It can be difficult for others to understand a program if there is inadequate commenting or poor layout. This would apply to any programming language, however.
'Postfix' notation takes time to appreciate (no brackets required!)