

Parameterized roles - sartak1
http://sartak.blogspot.com/2009/05/parameterized-roles.html

======
sho
Can someone give a simple explanation as to what "parameterized roles" are?
The article assumes knowledge of some Perl libraries; it does sound
interesting but I have no idea what the author is talking about.

~~~
draegtun
Did u follow the Perl6 parameter role link in the article?

This provides a nice example which may help....

    
    
      role Greet[Str $greeting] {
          method greet() { say $greeting }
      }
    
      class EnglishMan does Greet["Hello"] { }
      class Slovak does Greet["Ahoj"] { }
      class Lolcat does Greet["OH HAI"] { }
    
      EnglishMan.new.greet(); # Hello
      Slovak.new.greet();     # Ahoj
      Lolcat.new.greet();     # OH HAI
    

<http://rakudo.org/2009/01/parametric-roles.html>

~~~
sho
Oops, didn't see your reply for a while. I'll check out the explanation - very
interesting to me since I've been grappling with implementing flexible roles
programmatically for a while.

Thanks for the link!

