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


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

CellContext - Not ready for primetime use (opinion).

Started byJason Ledbetter <jasonbrent@gmail.com>
First post2011-01-28 11:13 +0000
Last post2011-01-28 11:13 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

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

#15744 — CellContext - Not ready for primetime use (opinion).

FromJason Ledbetter <jasonbrent@gmail.com>
Date2011-01-28 11:13 +0000
SubjectCellContext - Not ready for primetime use (opinion).
Message-ID<ihu8dm$1k4$1@smc.vnet.net>
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

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web