The Forth 94 Technical Committee was unable to identify any
common practice for locals. It provided a way to define locals
and a method of parsing them in the hope that a common practice
would emerge.
Since then, common practice has emerged. Most implementations that
provide
(LOCAL) and
LOCALS| also provide some form of the
{ ... } notation; however, the phrase { ... } conflicts with
other systems. The
{: ...
:}
notation is a compromise
to avoid name conflicts.
The notation provides for different kinds of local: those that are
initialized from the data stack at run-time, uninitialized locals, and
outputs. Initialized locals are separated from uninitialized locals by
`
|
'. The definition of locals is terminated by
`
--
' or `
:}
'.
All text between `
--
' and `
:}
' is ignored. This eases
documentation by allowing a complete stack comment in the locals definition.
The `
|
' (ASCII $7C) character is widely used as the
separator between local arguments and local values. Some implementations
have used `
\
' (ASCII $5C) or `
¦
' ($A6).
Systems are free to continue to provide these alternative separators.
However, only the recognition of the `
|
' separator is
mandatory. Therefore portable programs must use the `
|
'
separator.
A number of systems extend the locals notation in various ways. Some of
these extensions may emerge as common practice. This standard has reserved
the notation used by these extensions to avoid difficulties when porting
code to these systems. In particular local names ending in
`
:
' (colon),
`
[
' (open bracket), or
`
^
' (caret) are reserved.