On 2009-Oct-19, at 5:50 pm, Jon Lang wrote:
In "Aiasing methods in CPAN roles", David Green wrote:
I don't want my special log() method to work only for other types
that explicitly do NumLog; I want it to work for any type that
directly "does Numeric does Logging".
But if Logging doesn't do Numeric, why should it be expected to
provide a method that assumes that it does?
Well, I don't want all objects that do Logging to do Numeric; I just
want to have custom methods for those that do happen to do both.
I could declare a sub log(Numeric Logging $x) that would work when its
arg does both, but it has to be called like a sub, not a method.
If I can put ad hoc compound types into a signature, e.g. foo(Numeric
Logging) instead of foo(NumLog), then why shouldn't it be possible to
define a method that way? Or conversely, should compound types in
signatures be disallowed, and forced to use "NumLog"/whatever also?