# Tag Info

11

Using Begin and End won't help, because .mx files are lower-level and the way they are loaded is different from normal packages. I was about to say that this isn't possible, but here is a hack which seems to work: ClearAll[loadInContext]; loadInContext[context_String,file_String/;FileExtension[file]==="mx"]:= Module[{tag}, ...

9

One thing that might help you when investigating in such issues is the LinkSnooper. This is a java program that can be used to set up an additional kernel configuration. When you use this kernel, you can watch all traffic between front-end and kernel. With this, you could look what happens if you evaluate a simple 1+1 FE ---> K: ...

9

I will make no attempt to defend the fact that Mathematica simulates scoping by means of variable renaming. However, the behaviour that we see is consistent with the principles under which Mathematica does operate. Whenever Mathematica tries to interpret a symbol name, it first checks to see whether a symbol with that name already exists in a package in ...

7

The front-end-related operations are actually performed by Front End itself. According to the tutorial Executing Notebook Commands Directly in the Front End: When you execute a command like NotebookWrite[obj,data] the actual operation of inserting data into your notebook is performed in the front end. Normally, however, the kernel is needed in order to ...

6

Somehow I've overlooked this topic on MathGroup earlier: $CellContext Here's what John Fultz said:$CellContext is a symbolic placeholder in cell expressions (most typically Dynamic expressions inside of Cell) which indicates that the ambient context as defined by the CellContext option should be used (which allows you to wall off notebooks, cell ...

5

From the comments: But I'm mainly worried about the warning messages that Mathematica issues when I load both packages. If the packages are properly written, and if the symbol conflict is between two packages (and not builtins and a package function), then you can safely ignore it. From the documentation of BeginPackage: BeginPackage["context"] ...

4

I have been thinking recently a lot about this mysterious $CellContext, that turns up when we convert a cell with interactivity (such as Button, Slider, DynamicModule, Dynamic) to a cell expression. Just as Kuba, I found that there is not much documentation on this topic, but in MathGroup and SE there are some very valuable comments and remarks, not in the ... 4 This is all covered in the documentation. To answer your specific questions: Yes, just call Needs or Get more than once. Yes, by setting up contexts correctly Yes, but in Mathematica they are called Contexts. The issue is likely to be that you did not use a standard package structure to write your packages, including the Begin["Private"]. See the ... 3 For your second question this would define a global aContxt so that it can be used in other notebooks (to be evaluated in the notebook with the private context): GlobalaContext =$Context; Then you can define a new variable like this: SetDelayed @@ Join[Hold[varAnb], ToExpression[aContext <> "varA", InputForm, Hold]] the reason why this looks so ...

3

The standard way to expose a symbol which is defined within a private context is to define a usage string outside the private context, as in BeginPackage["MyPackage"]; Symbol1 = 1; Symbol2::usage = "Symbol2 is a test symbol"; Begin["MyContext"]; Symbol2 = 2; End[]; EndPackage[]; Actually, any mention of the symbol inside the package but outside the ...

3

I reported this problem to Wolfram technical support, and I have received the following response (edited for brevity). I was able to reproduce the issue you have reported. I have forwarded an incident report to our developers with the information you provided. I have tagged the question with bugs. Update This bug appears to be fixed in V10.0.1

2

Not each Cell but each CellGroup has separate context. If you create new cell you will get In[2]: You can confirm this thesis with: nb = Select[Notebooks[], "Help" === ("DocumentType" /. NotebookInformation[#]) &][[1]] Options[#, CellContext] & /@ Cells[nb, GeneratedCell -> False, CellStyle -> "Input"] {{CellContext -> ...

2

Interpolation is a built-in function located in the System context, which is the same for all Notebooks independently of $Context, hence any changes of Options of this function will be global. But you can define your own function in the local context and set local options for it (see here for explanations): Clear[interpolation]; Options[interpolation] = ... 2 It might be that this is due to dispatch, list and doStuff being completely owned by the frontend, since you wrapped them in a DynamicModule. Frontend variables cannot be shared between kernels. When you localize them in a Module, and therefore keep them as kernel variables, it works: Module[{dispatch, list, doStuff}, list = Range[8]; doStuff[a_] := ... 1 I think you have deal with Mathematica application. I know 2 way for solv this problem 1) Add path to your application in variable$Path. And then load with Get AppendTo[$Path,"C:\\path\\to\\your\\application"]; <<main This code try to find init.m in your application and evaluate it. 2) Save your application in directory$UserBaseDirectory ...

1

Problem Solved. If I start Mathematica 10 and immediately run Context["Classify"] it will says Context::notfound: Symbol Classify not found and if I run Context[Classify] note: without quote. Mathematica will tell you: "Global" But When I run Needs["MachineLearning"] and then run Context["Classify"] Mathematica gives System` ...

Only top voted, non community-wiki answers of a minimum length are eligible