Don't ask to ask, just ask | |
PerlMonks |
Re: perspective and object-disorientationby castaway (Parson) |
on Jan 18, 2003 at 12:28 UTC ( [id://227958]=note: print w/replies, xml ) | Need Help?? |
It's an interesting question.. You're looking at programming and OO as if you'd like to be able to define really complex systems with it (such as Real Life), to be able to use the exact same programm for different aspects at the same time. This doesn't really represent real life though. I would view a Person as something which changes states over time. He may be an Employee and a Trainspotter and a Father, but each of these states are not active simultaneously when they are being actively 'carried out'. When writing a programm/object in which you want to look at the objects in a lot of different perspectives, its better to deal with a generic object, and set states for however you are looking at it at the time. (Person->atWork(), Person->atHome(), Person->atTheTrainStation().. )
As to changing @ISA at runtime, its not occured to me to do that, and I can't think of a reason to do it at the moment (a real one). It did however, just occur to me, that you can also change the inherited classes as you like as well, theres nothing to stop you doing 'use base (Blah.pm);' and then add stuff to Blah.pm in your code (package Blah.pm; changestuff), or eval'ing code at runtime to do this.
It sounds like you're thinking of writing a self-evolving program which can change its own objects as it likes... Fun.. C.
In Section
Meditations
|
|