I am trying to understand the following behaviour, and determine if it's a bug in Mathematica 10. I am using Mathematica 10.3, and can't reproduce this behaviour under Mathematica 9. The test outlined below shows that evaluating Clear["Global`*"]
under one kernel clears the Global
context in another kernel, which I don't understand - I thought each kernel had it's own Global
context.
To demonstrate, I have created a simple notebook called clear.nb
containing:
Clear["Global`*"]
and nothing else. I have also created two new kernels called Test1 and Test2.
Now in another notebook I have the following:
f = 99.0
nb = NotebookOpen["/path/to/clear.nb"]
SetOptions[nb, Evaluator -> "Test1"]
NotebookEvaluate[nb]
Evaluating this notebook under kernel Test2
, I find that immediately after the NotebookEvaluate[nb]
both nb
and f
are no longer defined. In other words the Clear["Global`*"]
which has been evaluated by kernel Test1
has cleared the Global
context of kernel Test2
.
This is not what I expected at all, and now how it worked in Mathematica 9, where the Global
context of kernel Test2
is unaffected.
Is this a bug in Mathematica 10, or a bug in my understanding/expectation?