Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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

by Ovid (Cardinal)
on Nov 18, 2005 at 23:02 UTC ( [id://509989]=note: print w/replies, xml ) Need Help??


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

Not to mention the fact that it can be a nice performance boost and you can query the class to find out what traits/roles it implements.

Cheers,
Ovid

New address of my CGI Course.

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

Replies are listed 'Best First'.
Re^4: Informal Poll: why aren't you using traits?
by blm (Hermit) on Nov 19, 2005 at 05:38 UTC

    I would say that I had not heard of traits though I remember somewhere a mention of roles in perl 6. While reading the first few posts, a question formed in my mind "How are roles/traits different to interfaces?". Indeed your language in this post convinced me to post this.

    ...you can query the class to find out what traits/roles it implements.
      "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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://509989]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-18 12:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found