I like Steve Yegge's Prototype Pattern example and decided to whip up a quick proof of concept example.
However, I didn't really think things through. While it is great for dynamically specifying the behaviour of objects and is an easy solution to Steve's opinionated elf example, I'm still trying to work out the best way to handle instance variables.
For instance, let's say I have an AwesomeDragon object. I then want to make an AwesomeDragonImmuneToFire object so I make a new child of the AwesomeDragon (AwesomeDragonImmuneToFire inherits properties from AwesomeDragon) and 'put' "ImmuneToFire" as a property with a value of 'true'. So far so good. Now let's say I want to send my AwesomeDragon object on a tour of nearby peasant villages. This will involve updating the 'position' property of AwesomeDragon. However, the moment I do this AwesomeDragonImmuneToFire will take off as well.
Is the best solution to override instance values upon object creation e.g. immediately 'put' the 'position' value on AwesomeDragonImmuneToFire to the current 'get' value of 'position'?