On Wed, 2004-01-07 at 00:43, Jonathan Lang wrote:

> Maybe as an alternative to 
> 
>    role Stringify {must stringify();}
>    sub print_it (Stringify $thingie) {print $thingie.stringify();}
> 
> you might be able to say
> 
>    sub print_it ($thingie must stringify()) {print $thingie.stringify();}
> 
> Hmm... there's a certain elegance to being able to specify one or two
> requirements directly in a signature.

I'm not sure that works so well in practice.  You're explicitly asking
for a method with a particular name when you're ought to be asking for a
method with a particular meaning.  That is, if you said:

        method threaten ( $thingie must bark() ) { ... }

passing in a Tree object would work, when what you really want something
that does Doggish things, like a Dog, an Actor in a dog costume, or a
RobotDog.

Promoting role names to a position of typishness allows roles to express
the semantics and context of method names that method names alone can't
express uniquely.

Yikes, now I sound like Larry.

<Larry>Or maybe not.</Larry>

-- c

Reply via email to