On Thu, 10 Oct 2002, Larry Wall wrote:
: Anyway, I don't see offhand why composition can't simply be done with
: attributes as it is in C++, especially since attributes manifest as
: methods outside the class.  I don't think $car.cd.eject() is all that
: horrible to contemplate.

By the way, ever since we came up with "attr" in Zurich, I've been
hating it more and more.  I'm thinking that "has" reads a lot better:

    class Dog is Mammal {
        has Nose $.snout;
        has Ear  @.ears is cut("long");
        has Leg  @.legs;
        has Tail $.tail is cut("short");

        method Wag () {...}
    }

Or, along the lines of "my" lists:

    class Dog is Mammal {
        has (
            Nose $.snout,
            Ear  @.ears is cut("long"),
            Leg  @.legs,
            Tail $.tail is cut("short"),
        );

        method Wag () {...}
    }

Larry

Reply via email to