[Date Index] [Thread Index] [Author Index]
Why no option SaveDefinitions in DynamicModule?
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