[Grace-core] Inheritance and object initialisation

James Noble kjx at ecs.vuw.ac.nz
Tue Jul 24 18:41:11 PDT 2012


> Of course the case we're having problems with involve mutable objects.  Inheriting from immutable objects can be easily done by treating them as classes with parameterless constructors.

stateless traits. yes.   
Provided - of course - their constructors *dont* have any initialization code! 

> Any good examples of inheritance using mutable objects (ideally where the state has changed since it was created)?

I think the only clear semantics for inheritance from mutable objects is delegation.
Delegation removes the need for cloning or rerunning constructors (which seem to be 
to be two sides of the same coin)

J


More information about the Grace-core mailing list