Re: RFC 163 (v2) Objects: Autoaccessors for object data structures
[email protected] (Damian Conway) Thu, 21 Sep 2000 08:09:06 +1100 (EST)
| Newsgroups | perl.perl6.language.objects |
|---|---|
| Message-ID | <[email protected]> |
> I have a pretty primitive idea in my head: suppose a Taxi object has > multiple inheritance, it inherits from both a Car and a Driver... So a > Taxi is both a Car and a Driver. But shouldn't you also make this that a > Taxi is a Car that also *contains* a Driver, instead of *being* one? > > You can even take this further: that a Taxi is an object that contains > both a Car and a Driver. Poof, out the door go the conflicts... > > In order to make this work behind the scenes in OO Perl, multiple > inheritance should automatically call SUPER classes with the *contained* > object of that superclass, not with the object itself. If there's both a > Driver and a Car in a Taxi, Car methods have no need to be messing with > the Driver's properties, anyway... > > In my childish enthousiasm, I have the feeling that I've just hit a > jackpot... Have you looked at RFC 193 (Objects : Core support for method delegation). The mechanism described there is designed to solve exactly this problem. Damian