Description
On terminology and naming
Obviously, new terms (denotations) allow us to express ourselves more concisely, since we replace long phrases with single words. Also, simple terms allow us to introduce compound terms. This applies to both programming and speech.
Obviously, it is always better to create a new compound term from two simple terms rather than from a compound term and a simple term. So, introducing a simple term or simple name for a Forth word allows us to have shorter compound names based on that name.
For example, the name recognize-forth
is a compound name. When we use this name in other compound names, such as recognize-forth-sure
, recognize-forth-nt
, recognize-forth-nt-sure
, we get long names with many hyphens.
If we use the simple name perceive
instead of the compound name recognize-forth
, we will have shorter compound names: perceive-sure
, perceive-nt
, perceive-nt-sure
.
This also allows us to distinguish between general recognizers and the recognizer that the Forth text interpreter currently uses to recognize lexemes (i.e., the perceptor).
For example, we might have two completely different group of recognizers:
recognize-nt ( sd.lexeme -- nt tt-nt | 0 )
— find a word according to the search order;recognize-nt-sure ( sd.lexeme -- nt tt-nt )
— find a word according to the search order, throw the error -13 if it is not found;perceive-nt ( sd.lexeme -- nt tt-nt | 0 )
— execute the perceptor, discard its result if the result type is different from( nt tt-nt )
.perceive-nt-sure ( sd.lexeme -- nt tt-nt )
— execute the perceptor, if its result type is 0, throw the error -13, otherwise, if its result type is different from( nt tt-nt )
, throw the error -32 (invalid name argument).
The important thing is that what and how these recognizers recognize is obvious from their names and stack diagrams.
(from the recognizer chat, on 2024-10-08)