Beefy Boxes and Bandwidth Generously Provided by pair Networks Russ
No such thing as a small change
 
PerlMonks  

Re^5: Informal Poll: why aren't you using traits?

by stvn (Monsignor)
on Nov 19, 2005 at 09:02 UTC ( [id://510088]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re^4: Informal Poll: why aren't you using traits?
in thread Informal Poll: why aren't you using traits?

"How are roles/traits different to interfaces?"

An interface (in the Java sense) has no implementation, it is only a "signature" which the consumer of the interface promises to conform to.

Roles/Traits are allowed to have implementations. The methods in a trait are "flattened" into the consuming class. This is not all that different from just "exporting" methods from the trait's namespace into the classes namespace, except that there are a set of "rules" and "guidelines" set out in the Traits papers (see the SEE ALSO section of Class::Trait for some good links). These rules and guidelines actually make it so that Trait ordering is irrelevant, which right there removes a lot of the issues normally associated with MI and mix-ins.

-stvn
  • Comment on Re^5: Informal Poll: why aren't you using traits?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://510088]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.