in reply to Re: Class::Interface -- isa() Considered Harmful
in thread Class::Interface -- isa() Considered Harmful
You're right that can() is a better approach for protecting against methods that aren't there. I'm working on something at a higher level, though. For example, you don't have to check can() all the time. If you're handed an object, check that it implements the appropriate interface, then keep it around.
With interfaces, for example, it's easy to mixin a batch of methods from another class -- marked as an interface.
|
---|