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

Michael G Schwern schwern at pobox.com
Wed Mar 9 00:20:25 GMT 2011


On 2011.3.9 10:54 AM, Chris Prather wrote:
> On Mar 8, 2011, at 6:30 PM, Michael G Schwern <schwern at pobox.com> wrote:
> 
>> And then Moose's has => isa takes a type or a class.
> 
> Actually ISA always takes a Type Constraint or Type Constraint name.
> If you pass in a string it doesn't recognize as a type name it will
> assume it is a class name and auto-vivifies a class_name Type
> Constraint for it.

Yes.  From the POV of the user it takes a type or a class.


> Additionally in all the literature I've read on type theory recently
> they assume that classes (and by extension Roles) connote a type upon
> a data structure. So both classes and roles are always types but types
> are not always classes or roles.

Yes.  Now, how do we convey this to people who haven't read type theory?


-- 
If you want the truth to stand clear before you, never be for or against.
The struggle between "for" and "against" is the mind's worst disease.
    -- Sent-ts'an



More information about the Perl5-syntax mailing list