Locative abc_f_ refers to abc
in locale f; indirect locative abc__xy
refers to abc in the locale whose name is the current value
of xy. For compatibility with previous versions,
the non-standard abc__ is accepted and is the same
as abc_base_. Thus:
b=: 1 Rome=: 2 Rome_NewYork_=: 20 f_NewYork_=: 3 : '3*b=: Rome+y' f_NewYork_ 10 90 b,Rome 1 2 b_NewYork_ 30
A name is global if it is not assigned by =.
within Explicit Definition (:).
Every global name is executed in the current locale.
Initially, the current locale is base.
A locative f_abc_, while it is executing,
switches the current locale to abc.
The verb 18!:4
also switches the current locale,
and 18!:5 gives its name.
The name f_abc_ is executed in locale abc
in the sense that a global name referenced in f
is sought therein and, if not found, is then sought in the
locales in the path of abc
(but is still executed in abc).
The path of a locale is initially ,<,'z' ,
except that locale z has an empty path initially,
and may be changed using 18!:2 .
A locale is commonly populated by a script, by appropriate
naming of the verb used to execute the script.
For example, if the file stats contains the script:
mean=: sum % # sum=: +/
ssx_z_=: 0!:10 Silent script execution ssx_a_ <'stats' Populate locale a mean=: 'in base locale' mean_a_ 3 4 5 4 ssx_bc_ <'stats' Populate locale bc sum_bc_ 3 4 5 12
The example also illustrates the use of locale paths,
in this case the z locale: First,
the utility ssx is defined in the z locale.
In executing ssx_a_, ssx is not found in
locale a and is therefore sought (and found) in
locale z. Since ssx_a_ is executed
in locale a, the names in the stats script are
defined in locale a, populating it thereby.
Similarly for ssx_bc_.
See also 18!: in
Appendix A and the “Locales” and “Object Oriented Programming”
labs distributed with the system.