MathGroup Archive 2005

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

Search the Archive

Re: Lightweight Structs - Practical Example (Data Types in Mathematica)


Here's some strengthening of the approach (thanks to my friend Steve
Jones for pointing out weaknesses).


1. Protect the instance ID symbols from accidental definition, which
would sow havoc into any existing structs. Indeed, strengthen the
struct "constructor" to insure this:
   makeSensor[id_Symbol] := Module[{},
     Protect[id];
     Sensor[id]@radius = 0;
     Sensor[id]]

2. Similarly, Protect[] the fieldname symbols:
    Protect[radius]


  • Prev by Date: Re: preparing multiple choice questions
  • Next by Date: TableForm vs. GridBox
  • Previous by thread: Lightweight Structs - Practical Example (Data Types in Mathematica)
  • Next by thread: TableForm vs. GridBox