MathGroup Archive 2007

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

Search the Archive

Suggestions for Maintaining "Object" State?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg78331] Suggestions for Maintaining "Object" State?
  • From: "Carey Sublette" <careysub at earthling.net>
  • Date: Thu, 28 Jun 2007 04:32:26 -0400 (EDT)

I am starting to develop a fairly complex simulation using Mathematica 6 and 
am confronting a basic issue that I am unsure how best to resolve: "How to 
preserve the state of an object?"

Physical objects represented in a simulation have internal state that is 
preserved and affects how they respond to stimulus from the simulation 
environment.

Possible ways of implementing this behavior includes creating modules 
representing objects and:
*  exporting state to the session (or other enclosing scope) as a list of 
values, which either exists as a global variable or is passed in as a 
parameter;
* using UpValues or Tags to assign object state to symbols(?).

At the moment the objects in the simulation have a 1-to-1 relationship, 
there is only one of each type, which simplifies the problem, though in the 
future I may need to maintain state for multiple objects of the same type.

Does anyone have recommendations for how to do this, optimized either for 
convenience or efficiency? 



  • Prev by Date: Mathematica 5.0 Registration Conundrum
  • Next by Date: Re: Re: Why use Java in Mathematica?
  • Previous by thread: Mathematica 5.0 Registration Conundrum
  • Next by thread: Re: Suggestions for Maintaining "Object" State?