develooper Front page | perl.perl6.language | Postings from April 2003

RE: HELP! Type Casting [was: Type Coercions]

Thread Previous | Thread Next
From:
Austin Hastings
Date:
April 18, 2003 01:00
Subject:
RE: HELP! Type Casting [was: Type Coercions]
Message ID:
ICELKKFHGNOHCNCCCBKFOEODCDAA.ahasting@worldnet.att.net


> From: Damian Conway [mailto:damian@conway.org]
> >>	my Oak $tree = Dog.new();
> >>	my Dog $spot = Oak.new();
> >
> >
> > Why is that a problem?
>
> Because the bark() method of a tree has *nothing* to do with the
> bark() method of a dog. And is most unlikely to be interchangeable with
it.
> They just happen to be *named* with the same word.

Right. To me, that's a strong feature of Luke's scheme: You don't have to
"inherit" something to be able to do it.

Under the "you must inherit" scheme, we're essentially saying "We know more
than you about what you need." To me, that's questionable.

Under the interface scheme, we're saying "You know more than we do about
what you need." That's questionable, too :-) but it's more Perlish.

> Appearance (i.e. interface) doesn't make a one thing substitutable for
> another; genetics (i.e. inheritance) does.

There's no way that my mom's 8-track player and my computer's CD drive are
related to each other, and yet they have the same interface: insert, skip,
eject.

> Not that I'm saying Perl 6 shouldn't support interface polymorphism. It
> should. But its only an alternative to, not a replacement for,
> inheritance.

So when's A12 coming out?  :-)

=Austin


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About