The locale mechanism is the way to do it. The possibility of
locale-name collision is unavoidable.
In NuVoc we prefer the terms 'public' and 'private' to distinguish names
visible outside of vs. only inside explicit definitions. A name that is
public in its locale cannot be seen as a simple name from other locales.
Names defined in the z locale are truly global: visible as simple names
from anywhere.
Henry Rich
On 10/17/2017 8:12 AM, Rudolf Sykora wrote:
Hello,
several times I encountered a problem of scoping my variables.
As I understand, variables in J are either global, or local.
This is fairly similar to C, but in C the globals may be globals
just within a file, and, unless marked extern, they are still
invisible to the outside.
Since local variables of a function are not visible to functions
called by the function, I do not see a good way to limit the scope
of my variables. Using _locale_ is not a good way either, since it
may happen somobody else will incidently create the same _locale_,
which will later interfere with mine.
Solving this with objects together with automatically-created numbered
_locale_ seems a bit too heavy weapon.
Is there a good way?
Thanks for comments
Ruda
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
---
This email has been checked for viruses by AVG.
http://www.avg.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm