Re: What is the point of having Initializations in DynamicModule and Manipulate?

*To*: mathgroup at smc.vnet.net*Subject*: [mg123243] Re: What is the point of having Initializations in DynamicModule and Manipulate?*From*: Chris Degnen <degnen at cwgsy.net>*Date*: Tue, 29 Nov 2011 07:03:03 -0500 (EST)*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com*References*: <jad5q6$eh2$1@smc.vnet.net>

The following is somewhat tangential to the initial question: John Fultz wrote: > > Question...what do I do if I want thing A to evaluate before > thing B? Why, of course, use any number of Mathematica > paradigms for sequential evaluation. The semicolon, representing > CompoundExpression, for example. No need to invent anything here. > > Further question...what if I want thing A to evaluate before > thing B, but thing B is part of a dynamic interface. This is > the interesting question. There are absolutely no guarantees > about the order in which two discrete Dynamics will evaluate, > so I can't set up multiple Dynamics in a row to evaluate in > sequence. I could nest Dynamics (outer ones always evaluate > before inner ones), but then I may have to play some tricky > games with Refresh to prevent code from evaluating which > should only ever evaluate once. Sal Mangano wrote about this issue in The Mathematica Cookbook, starting at page 613: "as explained by Theodore Gray ... using DynamicWrapper will always guarantee that the second argument of DynamicWrapper will be computed before any dynamic expressions contained in the first argument." In effect it appears to be similar to nesting Dynamics, at least in one respect; and is unlike Initialize in that the second argument is dynamically updated. An example is given: http://demonstrations.wolfram.com/2DCellularAutomatonAnimations/ where nested DynamicWrappers are used. Documentation for DynamicWrapper only appeared in version 8 although the functionality exists in versions 6 and 7.