The following page contains reserved words. These are not part of the ANS Forth Standard. They are just proposed by various people and published here at FORTH.SF.NET for public review.

:NON:
:STD:

TOC


R.13 Locals reserved extension words


R.13.6.1.0068 LVALUE / LOCAL
LOCALS RES EXT
        Compressed Syntax: ( n [name] -- ) : [name] ( -- n )
Interpretation: Interpretion semantics for this word are undefined
        Compilation: ( "name" -- )

Create a new local identifier by skipping leading spaces, parsing the name, and executing 13.6.1.0086 (LOCAL) and assign cellsize data space in the locals frame to the identifier. Append the run-time semantics to the current definition to initialize the data cell denoted by the name with the current value on stack.

        Run-time:  ( n -- )

Append execution semantics to the local identifier to return the data cell value to the parameter stack.

       Execution: ( -- n )

The identifier is subject to the LOCALS TO extension thereby imitating a 6.2.2405 VALUE

note: most system using 13.6.2.1795 LOCALS|, declarations can not be easily extended with R.13.6.1.0068 LVALUE declarations since the locals-frame is setup by the execution code compiled by the LOCALS| call and any LVALUE would need to add to it but without adding initialization code - the locals-frame setup code (often called "LOCALS" or "(LOCALS)") is split into a an area of LOCALS| values that get initialized immediatly and an LVALUE part that gets initialized at the point of declaration within the current defintition. Furthermore LOCALS| has the tendency to call (LOCAL) once with that END-flag while this is should be done just implicitly for the current feature of LVALUE declarations at the end of the definition (or the END-flag is not necessary or just ignored).

a simple approach could be to let the special-syntax word LOCALS| translate all local declarations to be simply calls to LVALUE that stops when a peek into the input-area can see a "|" character. A decompile might yield this:

   : test LOCALS| a b c d | 2drop 2drop ;
   see test
   : test LOCALS LVALUE a LVALUE b LVALUE c LVALUE d 2DROP 2DROP ;
which also explains why the LOCALS| names get initialized in the reverse order of the usual stackeffect declarations as it is also used in this standard.

See: 13.6.1.0086 (LOCAL), 6.2.2405 VALUE 13.6.1.2295 TO, 13.6.2.1795 LOCALS|,


Table of Contents
Next Section