JMP uses the global namespace as the default namespace for any new script, the way to specify a "local" namespace is the Names Default to Here(1)command. My question is this, when I include a file that has the Names Default to Here(1) at the top it will bring over the names/variables from the child script. However, if I define
include("filepath/name.ext", << New Context, << NamesDefaultToHere)
it will keep the namespaces separate.. What is the reasoning behind this? It seems like it should be doing the same thing? Since I am using an Include statement does it assume I want to absorb the names from the child script?
The below set returns x = 10, even though NamesDefaultToHere(1) is in script B
Script A
x = 5;
include("filepath/script_B.jsl");
show(x);
Script B
namesDefaultToHere(1);
x = 10;
While this one returns x =5, because I had the namesDefaultToHere in the include statement
Script A
x = 5;
include("filepath/script_B.jsl", << newContext, <<namesDefaultToHere);
show(x);
Script B
namesDefaultToHere(1);
x = 10