On Sat Aug 11 16:54:36 2007, MSCHWERN wrote:
Show quoted text> On Tue Jul 31 08:28:05 2007, RJBS wrote:
> > If I say I want my base class to be X, I don't mean "unless I
> > accidentally already set it somewhere else, in which case make me
> > accidentally use multiple inheritance."
----
And you see -- I would want just the opposite.
I always push'ed to ISA, since that was the inheritance model that
seemed most correct -- i.e.
mammal => base for 'dog'
dog => base for 'beagle',
I'd expect 'beagle to inherit properties from mammal that were
not overridden.
Doesn't matter if you came along and did a 'use dog', dog would be a
subclass of mammal.
If you wanted the behavior you specify, you could define your own
class 'dog':
package tax_collector;
use reptile;
package joe;
use tax_collector;
if (can joe->cold_blooded) {
print "Joe is cold-blooded\n";
}
...
You could do this with use 'base'.
You would not as easily be able to do this in standard perl,
as it's use statement will read in the disk copy, causing unknown
consequences.
Somehow this "spooky, at a distance" behavior is considered a feature.
I think it would be good if 'base' had adjectives to force it to go to
disk.
It might, in some cases (perhaps yours), even be preferable for any
in-memory class to be purged before reading in a new class, but that
might cause other unexpected side effects.