MathGroup Archive 2012

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

Search the Archive

LocalizeVariables doesn't!

  • To: mathgroup at
  • Subject: [mg123940] LocalizeVariables doesn't!
  • From: Frank Iannarilli <frankeye at>
  • Date: Sun, 1 Jan 2012 02:27:01 -0500 (EST)
  • Delivered-to:
  • Reply-to: comp.soft-sys.math.mathematica at

My reading of Docs on the LocalizeVariables->True option of Manipulate[] is that all variables associated with Controls will be localized (inside a DynamicModule).  To prevent "local" Manipulate variable name leaks into the Global namespace, I declare them as "dummy" controls, using: ControlType->None.  But this evidently doesn't work as I'd expect:

Try the following execution sequence:

  (* should NOT list myPicture as a variable *)

symbolLeaker[]:= Manipulate[....  (* definition cell later below *)
symbolLeaker[]  (* Invoke it *)

   (* myPicture now shows up in the Global` namespace !??! *)

What gives?



symbolLeaker[] := Manipulate[
  myPicture = Table[Sin[i*j/cdivisor], {i, 1, 32}, {j, 1, 32}];
  ListPlot3D[myPicture, PlotLabel -> "Image", PlotRange -> All],
  (* >>>>>>> CONTROL/LAYOUT SECTION <<<<<<<<< *)
  Item[Style["Symbol Leaker", 16, Bold, Brown], Alignment -> Center],
  {{cdivisor, 64, "Sine Inverse Freq."}, Range[4, 128]},
  (* Dummy control variables,
  which are actually variables we'd like to keep localized to within \
this Manipulate, or otherwise they'd leak out as session-
  global variables.  A good rule of thumb:
  if a variable is included in TrackSymbols, it better be localized. 
  True localizes variables associated with Controls.  *)
  {myPicture, ControlType -> None},
  (* Manipulate options *)
  LocalizeVariables -> True,
  TrackedSymbols :> {cdivisor},
  ContinuousAction -> False

  • Prev by Date: Erf funcion
  • Next by Date: What is the recommended way to set up definitions for or initialize a palette?
  • Previous by thread: Re: Erf funcion
  • Next by thread: What is the recommended way to set up definitions for or initialize a palette?