Re: Packaged Dynamic Problem
- To: mathgroup at smc.vnet.net
- Subject: [mg104044] Re: Packaged Dynamic Problem
- From: Albert Retey <awnl at gmx-topmail.de>
- Date: Fri, 16 Oct 2009 07:22:13 -0400 (EDT)
- References: <hb70an$8sf$1@smc.vnet.net>
Hi, > > I have this interesting problem, where a package interferes with > global variables, and I cannot even find the root of this problem. I > managed to scale down the issue to a toy model, concerning two files, > a working notebook, and a package. You can guess, it wasn't easy. > > The working notebook (one cell): > > DynamicModule[{x = 0}, {Slider[Dynamic@x, {-1, 1}], Dynamic@x}, > Initialization :> Needs@"Test`"] > > And the package file (named Test.nb, and also .m, one cell): > > BeginPackage["Test`"]; > FirstFunction::usage = ""; > Verbose::usage = > If[ValueQ[Verbose::usage], Verbose::usage <> "some text", > "other text"]; > Begin["`Private`"]; > End[]; > EndPackage[]; > > On my system (7.0.1, WinXP SP2) the working notebook takes at least > for 25 seconds to evaluate (with a fresh kernel), during which my > whole system freezes, and then drops a "One or more dynamic objects > are taking excessively long to finish..." dialogue. I can hit the > 'Continue waiting' button, and the slider+value list immediately > appears, but this shouldn't take 25 seconds. (Of course, in this > model, there is no need to call for the Test` package, but > nevertheless, it seems to be the cause of the problem.) > Also if I re-evaluate the DynamicModule (without restarting the > kernel), it gives me an error message: > > x$$::shdw: Symbol x$$ appears in multiple contexts {Test`,Global`}; > definitions in context Test` may shadow or be shadowed by other > definitions. >> > > Clearly there is no x$$ variable defined in Test`, so I don't > understand this message. > > The most peculiar thing is that removing either of the usage messages > (with lhs and rhs) from the package seems to solve the problem, at > least in my case. Thus the issue is not specific on one message. I > have no idea how I should advance from this point. > > Can anyone reproduce this issue? no, I just have tried it and it seems to work without problems (Mathematica 7.0.1, Windows XP SP2). > Can anyone comment on it? not really, but are you sure you are loading the package you want to? Have you looked at the m-file you are loading with a text editor to make sure it doesn't contain anything unexpected? hth, albert