[Perl5-syntax] How to test for a role in a method signature

Reverend Chip rev.chip at gmail.com
Fri Mar 4 07:16:45 GMT 2011


On 3/3/2011 10:32 PM, Piers Cawley wrote:
> Personally, I prefer the flow of 'Typed $parameter does coerce', where
> the constraint declaration is always to the left of the parameter name
> and the right hand side is for declaring stuff about how the parameter
> is initialized. I would encourage anyone wanting to constrain by type
> to declare a type along the lines of "subtype DoesRole, as role_type
> 'Role'" ...

No, I don't buy it.  The "isa" and "does" tests are so fundamental and
common that forcing people to type that much to get the test would
violate Huffman.

Count me as favoring "$x does Foo".




More information about the Perl5-syntax mailing list