Skip to content

Is it okay to name the ":isa" attribute for single inheritance? #72

Answered by HaraldJoerg
yuki-kimoto asked this question in Q&A
Discussion options

You must be logged in to vote

In short: It is ok to name the ":isa" attribute for single inheritance.

Both the attribute and the operator can be read like "is a" in English to give the correct understanding. A customer is a person - makes sense. "is a" expects singular terms on both sides.

In your example if ($object isa Role1) the code will not return true: Role1 is not a class, and not added to the @ISA of MyClass. With Corinna this could be caught as a syntax error because Corinna roles identify themselves at compile time. Applied to a role implemented with Moose::Role, isa Role simply returns false.

A corresponding does operator in Perl does not yet exist because Perl core does not have roles (yet).

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@yuki-kimoto
Comment options

Answer selected by yuki-kimoto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants