Names are resolved as follows:

a. There is a global symbol table for each locale. A global symbol table can be switched as an effect of 18!:4 or of executing a locative.

b. There is a local symbol table for each execution of an explicit definition.

c. A locative is sought in the current global symbol table and then in the search path (18!:2) for that table.

d. A non-locative is sought first in the local symbol table and then in the global symbol table.

e. Assignment to a non-locative using =. within an explicit definition is local. All other assignments are global. Global assignment to a local name is not permitted.

f. An undefined name is assumed to be a verb.

g. A name may not change its class (noun/verb/adverb/conjunction) within a context of 4 words, the magic number 4 being significant as the number of words in the execution context of the parser stack. Roughly speaking, changing the class of a name and then using that name all on the same line should be avoided.

The following examples were executed in a new session:

   c ] ". 'c=:1'
|domain error: c
|       c]".'c=:1'

The leftmost c is undefined and is treated as verb. Once the 4 words are on the parser stack ". is executed and c is assigned to be 1, a noun. A domain error is then signalled when c 1 is executed and c is found to have changed its class.

Compare with the following:

   d=: +:
   d ] ". 'd=:1'
|domain error: d
|       d]".'d=:1'

   e ] ] ". 'e=:1'
1



Commentary

You can use @SIG@ to sign your comments and questions.

Essays/Name Resolution (last edited 2008-12-08 10:45:45 by )