Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #15744

CellContext - Not ready for primetime use (opinion).

From Jason Ledbetter <jasonbrent@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject CellContext - Not ready for primetime use (opinion).
Date 2011-01-28 11:13 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <ihu8dm$1k4$1@smc.vnet.net> (permalink)

Show all headers | View raw


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`[1].

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[2]).

[1] This brings up a couple of issues.. for example customizing $ContextPath
without user intervention to include things like DatabaseLink`, etc.
[2] 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

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

CellContext - Not ready for primetime use (opinion). Jason Ledbetter <jasonbrent@gmail.com> - 2011-01-28 11:13 +0000

csiph-web