[Date Index] [Thread Index] [Author Index]
Re: CellContext - Not ready for primetime use (opinion).
I independently discovered some wonkiness with contexts and NotebookEvaluate a couple of months ago and discussed it with the developer of NotebookEvaluate at that time. I couldn't remember the resolution, so I just tried your basic example in the development version of 8.0.1 to see if the problem remains, and it doesn't. 8.0.1 will be coming out pretty soon, so you should see a remedy to that issue soon. That having been said, though, you bring up several other issues (the docked cell issue, the CellProlog issue) without accompanying examples which I didn't test. The underlying logic is sophisticated, so it's difficult for me to saywith any real certainty whether the context issues have been completely squished here. But if you would like to send me other examples, I'm happy to try themout and follow up on anything that's still broken. Sincerely, John Fultz jfultz at wolfram.com User Interface Group Wolfram Research, Inc. On Fri, 28 Jan 2011 06:13:36 -0500 (EST), Jason Ledbetter wrote: > Folk, > > Are any of you using CellContext with a user specified string > successfully? > e.g., CellContext->"someThing`". > > I've read the various threads on mathgroup that say "don't use that", but > I'm sometimes stubborn. :-) > > I think I've come to the conclusion that CellContext just isn't ready for > prime-time use outside of what WRI is using it for, despite it being in > the > documentation. Wolfram's support has been of very limited assistance as > everything they come up with takes two steps back. > > Here's a simple example: > > --snip-- > Remove[nb] > nb==CreateDocument; > SetOptions[nb,CellContext->"mine`"]; > --snip-- > > In the resulting document execute: > Dynamic[$Context] > Dynamic[$ContextPath] > > You'll observe that the result is "mine`" which exactly matches the > documentation and that the $ContextPath has been changed to include > System` > and mine`. > > Let's suppose you want to now customize something in the resulting > notebook > like customize $ContextPath. The obvious way would be NotebookWrite and > NotebookEvaluate (this was a solution provided by some DatabaseLink > developer @ Wolfram)... > > Back in the original notebook execute the following and watch the results= : > > --snip-- > NotebookWrite[nb,"40+2"]; > NotebookEvaluate[nb] > --snip-- > > The Context/ContextPath get changed back to Global`... which means > anything > written to that document and executed through NotebookEvaluate > completely > tears down any explicit context/path that was setup through other > mechanisms > (like CellProlog). > >  This brings up a couple of issues.. for example customizing > $ContextPath > without user intervention to include things like DatabaseLink`, etc. >  This leads to other novel problems... DockedCells get a different > context/path than that of the notebook itself resulting in situations > where > buttons in the dock only do the correct thing on their second action... > > -jbl