Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: Solving compositional problems with Perl 6 roles

by Velaki (Chaplain)
on Aug 22, 2004 at 15:46 UTC ( #384937=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Solving compositional problems with Perl 6 roles
in thread Solving compositional problems with Perl 6 roles

Ultimately, it appears that the crux of the matter is defining what is a behavior vs. what is a trait.

A thief IS a Character who "implements/HAS" the behavior/interface of methods associated with "thieving". An Elf is a Character who IS a type of Character, who HAS certain additional traits.

It's all going to come down to whether you think of the character as an "elf type-of thief," or a "thief type-of elf." This will determine which is the child class by inheritance, and which is the child by "mix-in".

Just some thoughts,
-v
"Perl. There is no substitute."


Comment on Re^3: Solving compositional problems with Perl 6 roles
Replies are listed 'Best First'.
Re^4: Solving compositional problems with Perl 6 roles
by kappa (Chaplain) on Aug 23, 2004 at 12:17 UTC
    Would be nice to NOT know whether $stranger is an "elf type-of thief" or "thief type-of elf" and be able to do this:
    # ".?" means "call if the obj CAN the method" acc. to Apoc12 $stranger.?steal; $stranger.?shoot_arrows;
    and expect DWIMming (doing both things in both cases). That's the whole point of polymorphism, is it not? :)

    Update: upgrade perl5 syntax to perl6 (Apoc12).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://384937]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (9)
As of 2015-07-31 07:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (275 votes), past polls