Raul is correct.
The terms 'local' and 'global' used in the Dictionary are misleading.
NuVoc uses 'private' and 'public'.
Locales give you a level of namespace between local and global. When a
locale is in your search path you have direct access to its names. Any
verb can see these names, but only if they know the locale to look at.
Private names are always private the the entity they are created in.
True globals - names visible to all - are the ones in z locale, because
of the convention that all search paths will end with z.
Henry Rich
On 7/15/2021 10:04 AM, Raul Miller wrote:
This issue is not specific to tacit definitions -- you will encounter
this in all uses of all variables.
For example, try this in a script:
a=. 1
3 :0 ''
echo a
)
Unless you also have a global definition for a, when you run that
script, you would get an error:
|noun result was required: script
| echo a
(And the same thing would happen if you used the variable b instead of
the variable a ...)
What's happening here is that scripts are loaded by a verb. (So that
a=.1 is local to that verb.)
In a j session, unless you are suspended in an explicit verb (using
the debugging features), a statement like this:
a=. 1
actually behaves like this:
a=: 1
Perhaps this should instead throw an error? But, anyways, that's how
it currently works. This can be convenient when testing code fragments
using copy and paste, but it does require some understanding.
But, inside a local definition, a=.1 assigns the value 1 to a local
definition of a, and that local definition is only accessible in that
verb.
I could go on and talk about the reasons for this and how to get
differing features if that is needed, but hopefully, for now, this is
sufficient for you?
Thanks,
--
This email has been checked for viruses by AVG.
https://www.avg.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm