> On Tue, Oct 01, 2002 at 03:43:22PM -0400, Trey Harris wrote:
>> You want something like
>>
>>   class Car is Vehicle renames(drive => accel)
>>             is MP3_Player renames(drive => mp3_drive);

I *really* like this, but would the above be better coded as:

        class Car is Vehicle renames(drive => accel)
                has MP3_Player renames(drive => mp3_drive);

.... implying a "container" relationship with automatic delegation?  
Among the other considerations is that if you simply said

        class Car is Vehicle has MP3_Player;

the inheritance chain could assume that Car.drive === Vehicle.drive, 
because is-a (inheritance) beats has-a (containment or delegation).  If 
you needed to, you should still be able to call $mycar.MP3_Player.drive 
to DWYM, too.

Along these lines, I'd love the ability to do something like:
        
        class Bird is Animal
                has (LeftWing is Wing)  # a "named" Wing
                has (RightWing is Wing)
                has (LeftLeg is Leg)
                has (RightLeg is Leg);
        
        $bird.LeftWing.flap;            # makes sense
        $bird.flap;                             # but what's this do? left, right, or 
_both_?
        $bird^.Wing.flap                # perhaps too evil?  :-)

MikeL

Reply via email to