I wasn't thinking of those as types (and it wasn't meant as a final product, just an example of the way i was thinking about roles and does), I was thinking of them as roles since we are talking about does, and does talks about roles. If something reports that it does a role then its that somethings responsibility to insure it does. SO if i create a class that claims it does 'ARRAY' then it is my class's responsibility to insure that it can do everything that role entails. I see now reading your reply to chromatic that you aren't realy talking about roles at all which is where the disconnect is.

If we assume that DOES is for roles, why not overload ->can to do what you want?. You do a role, but you can a method. So if you wanted to ask if you can dereference it as an array you ask if it <cdoe>->can($obj, '@{}')</code> to me that seems to follow your overloading style better as it doesn't imply that '@()' is a role, but actually that it is a method, which it is if you've overloaded it.


___________
Eric Hodges

In reply to Re^5: I don't understand UNIVERSAL::DOES() by eric256
in thread I don't understand UNIVERSAL::DOES() by rlb3

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.