If I have a shared data structure like you would find in nested C structs, how would I best implement that in Mathematica?
I have some "object-oriented" code I would like to port to Mathematica. It's not really objected-oriented, except in the sense that there are parent objects and child objects inherit various fields from a common parent. So, for example, there is MovingObject which has velocity, heading, x_position, y_position, etc., and then there are various classes that inherit these common fields. So, you might have a car object, boat object, plane object, etc, all of which extend MovingObject.
The shared methods are non-existent or trivial, so the main thing is just how to share the movement-related data fields.
Association-s with a field called"Type"(or justType), possibly wrapped in inert symbol(s) if you need to useUpValuesand overload some methods, or if you need mutability. Have a look at this example for such a use, for both mutable and immutable case. – Leonid Shifrin May 11 '16 at 17:06