I need to evaluate
before I can use functions such as
GraphPath. When I do so, some functions get colored red, but still work.
Why does this happen and can I change this?
The red colouring indicates shadowing — i.e., when a symbol originally in a particular context, is exposed to the current context path, thereby clashing with another symbol of the same name in a different context, also on the context path.
Example of shadowing:
Here is a short example that demonstrates this. Try it out in a fresh kernel (call
So far, all's well and you see the symbols coloured the way you're used to. Now expose
You'll now notice that both the
Which definition is used in case of a conflict?
The definition that is used first, in the case of shadowing, is the one belonging to the context that appears first in
In the above example, I used
Now quit your kernel and do the same, except now you place the new context at the end. You can see that the definition used is that of
Incidentally, it is also possible to trigger this shadowing warning (red colour) even if there isn't a real conflict. This can occur if the same context appears at different positions in
Changing the colour of the warning
To change the colour from red to your favourite, go to