Because Perl5's OO system sucks rocks and is not to be trusted beyond a simple usage. I say this as someone whose CPAN distros are either OO (Tree, PDF::Template, Excel::Template) or OO-related (Perl6::Roles, Class::LazyLoad). Perl5 OO is kinda like the Wizard of Oz - as long as you don't look behind the curtain, everything is ok. The moment you do, even if by accident!, you're completely and utterly screwed. And, the worst part is that you may not realize you're screwed until you lose the client's data.

Adding roles to an introspective OO language that supports aliasing, like Ruby, isn't hard. I may do that for Ruby, now that I'm thinking about it. Ruby's traits.rb isn't Traits, it's a better version of attribute declarations. So, maybe I should call it roles.rb.

Adding it to Perl, however, is way too complicated. Writing Perl6::Roles was a pain in my butt. Not because the code was hard, but because I had to write so much scaffolding and assume so much about how things worked that it made my head hurt. And, that was with punting a whole lot to the user. That's why it's so limited in what it does. There is no attributes, not expectations, or anything. The free-for-all that is Perl's OO actually makes things worse than better.

As for your question - I would gladly use traits/roles/whatever-they're-called-this-week. But, only if they were well-defined. Right now, as Zaxo said, they're an experimental concept. For example:

Yes, I know a lot of those questions have answers. stvn has done a lot of work in Class::Traits, in his work on the Perl6 metamodel, and in helping me write Perl6::Roles. In all that, he's come up with some darn good answers to a bunch of those questions. That doesn't mean that his answers are complete. And, frankly, his answers may be wrong for some situations.

(Note: stvn doesn't use traits in his production work ... maybe that's a sign that traits aren't ready for primetime.)


My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

In reply to Re: Informal Poll: why aren't you using traits? by dragonchild
in thread Informal Poll: why aren't you using traits? by Ovid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.