ForthOS control of scope of identifiers
However, it is often the case that certain functions, constants, or variables are only ever used within a very restricted range of source. The ability to bound the scope of an identifier is thus helpful, as it makes this limited scope explicit, and helps keep the definitions vocabulary from becoming littered with transient names.
: localDef ( -- ) ; Local
Local operates upon the most recent definition. It records this definition, and arranges that this identifier will be removed from the definitions vocabulary when either the "only" or "definitions" words are invoked. It is thus used when a word will be used by subsequent words, but should not be visible beyond the end of compilation of this source.
: verylocalDef ( -- ) ; scrLocal
scrLocal is similar to Local, but provides an even more limited scope. The affected word is removed from visibility when the current source screen is completed.
Thus, setting a breakpoint in "verylocalDef" is accomplished with: