in reply to Re^4: I don't understand UNIVERSAL::DOES()
in thread I don't understand UNIVERSAL::DOES()
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: I don't understand UNIVERSAL::DOES()
by demerphq (Chancellor) on Mar 10, 2007 at 17:42 UTC | |
by eric256 (Parson) on Mar 10, 2007 at 23:08 UTC | |
by demerphq (Chancellor) on Mar 11, 2007 at 08:34 UTC |