8
$\begingroup$
BeginPackage["First`"];
    symbol;
EndPackage[];

BeginPackage["Second`"];
    (*This block could be replaced with Needs @ "Internal`" in real life*)
    BeginPackage["Internal`"]; 
        symbol;
    EndPackage[];
EndPackage[];

symbol::shdw: Symbol symbol appears in multiple contexts {Internal`,First`}; definitions in context Internal` may shadow or be shadowed by other definitions.

I find it annoying because Internal` won't be on $ContextPath at the same time as First`. I don't want to switch this message Off.

Is it a bug or a feature? It should be possible to only investigate the previous state of the context path stack, or did I miss something?

$\endgroup$
  • 2
    $\begingroup$ I used Quiet when I encountered the same issue. github.com/szhorvat/LTemplate/blob/master/LTemplate/… It affects LTemplate like this: LTemplate can be loaded on its own, but it can also be embedded into another package (IGraph/M is based on it). If it was already loaded on its own, then a package that embeds it was loaded afterwards, then a shadowing message would be issued. $\endgroup$ – Szabolcs Feb 12 '19 at 15:18
  • 6
    $\begingroup$ It seems to be a bug. There have been internal discussions about this. Very annoying indeed. Hopefully it will be addressed soon enough. $\endgroup$ – Leonid Shifrin Feb 12 '19 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.