develooper Front page | perl.perl6.language | Postings from May 2005

Re: Junctions of classes, roles, etc.

Thread Previous | Thread Next
From:
Abhijit Mahabal
Date:
May 2, 2005 11:17
Subject:
Re: Junctions of classes, roles, etc.
Message ID:
Pine.LNX.4.62.0505021308050.1900@sluggo.cs.indiana.edu
On Mon, 2 May 2005, [ISO-8859-1] Thomas Sandlaß wrote:

> David Storrs wrote:
>>  Tell me what this does:
>> 
>> 
>>  class Tree {      method bark() { die "Cannot instantiate a Tree--it is 
>>  abstract!" }
>>  }
>>  class Birch {      method bark() { return "White, papery" }
>>  }
>>  class Oak {      method bark() { return "Dark, heavy" }
>>  }
>>  class Dog {
>>       method bark() { print "Woof, woof!"; return "bow wow" }
>>  }
>
> Four 'pure' classes so far.
>
>
>>  class AlienBeastie isa Tree isa Dog {}
>
> Here you get an error/warning of a composition time conflict between
> &Tree::bark and &Dog::bark.

I don't think so; I had come to the same conclusion before realising that 
we are talking inheritance here, not roles. So no trouble at class 
composition time. Superclasses do not enter the picture while composing.

You'd be right if s/isa/is/ and then s/is/does/, of course.

When you dispatch, what happens would depend upon WALKMETH (according to 
the pseudocode for CALLONE in A12). Usually the first inherited method 
would get called.

> TSa (Thomas Sandlaß)

regards,
 	abhijit

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