A script saved under the name 'ntest.ijs':
NB. Start of script______________

cocurrent 'labc'
a=:'In locale labc'
b=.'A temporary created while in locale labc'
b_labc_=.'Another global'
a;b;b_labc_

cocurrent 'ldef'
a=:'In locale ldef'
a;b

NB. End of Script________________

Running the script with an explicit verb:

   loadd 'ntest.ijs'
   NB. Start of script______________

   cocurrent 'labc'
   a=:'In locale labc'
   b=.'A temporary created while in locale labc'
   b_labc_=.'Another global'
   a;b;b_labc_
+--------------+----------------------------------------+--------------+
|In locale labc|A temporary created while in locale labc|Another global|
+--------------+----------------------------------------+--------------+

   cocurrent 'ldef'
   a=:'In locale ldef'
   a;b
+--------------+----------------------------------------+
|In locale ldef|A temporary created while in locale labc|
+--------------+----------------------------------------+

   NB. End of Script________________

Running the script tacitly:

   0!:001 <'ntest.ijs'
   NB. Start of script______________

   cocurrent 'labc'
   a=:'In locale labc'
   b=.'A temporary created while in locale labc'
   b_labc_=.'Another global'
   a;b;b_labc_
+--------------+--------------+--------------+
|In locale labc|Another global|Another global|
+--------------+--------------+--------------+

   cocurrent 'ldef'
   a=:'In locale ldef'
   a;b
+--------------+-+-+
|In locale ldef|;|b|
+--------------+-+-+

   NB. End of Script________________

   coname''
+----+
|ldef|
+----+

___________________

The name b is a local name and persists over the switch of locales when run
under loadd but not when run under a tacit verb. It is a global name even
though it is defined using a local copula.



Notice that the second definition of b is defined with a local copula but
produced a global definition and it got around the error of creating a
global name which is also a local.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to