MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Why no option SaveDefinitions in DynamicModule?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg79986] Why no option SaveDefinitions in DynamicModule?
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Fri, 10 Aug 2007 01:46:32 -0400 (EDT)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • Reply-to: murray at math.umass.edu

Manipulate allows the option SaveDefinitions->True. If the Manipulate 
expression depends upon objects defined outside it, using this option 
can be advantageous: If you evaluate the Manipulate and then save the 
notebook and open it at a new session, the output from Manipulate will 
still be "live"; you do not have to evaluate those outside definitions 
again.

I'd like to accomplish the same thing in a DynamicModule. Unfortunately, 
SaveDefinitions is not a legal option for DynamicModule.  There is a 
work-around in that DynamicModule allows the option
Initialization for local variables, which could be function definitions.

But using Initialization in a DynamicModule necessitates moving inside 
DynamicModule all the definitions you really want outside it. Indeed, if 
you're going to use Initialization, you might as well just use a 
compound expression as the second argument to DynamicModule, giving the 
definitions required.

This defeats the neat way that Manipulate's SaveDefinitions option keeps 
the main function shorter and allows modularizing the code.

Is there some other way to keep the other definitions outside 
DynamicModule and yet have the same effect as Manipulate's SaveDefinition?

Or is this just an unintended (or intended!) design limitation?

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305


  • Prev by Date: Locator Appearance mystery in LocatorPane
  • Next by Date: Re: NMinimize a function of NMaximize
  • Previous by thread: Re: Re: Re: Locator Appearance mystery in LocatorPane
  • Next by thread: frameticks and LogScale