R
Rainer Weikusat
Another trivial thing I'm actually using: Can be implemented via
AUTOLOAD. The fact that UNIVERSAL->can and AUTOLOAD don't play nice
with each other is actually documented. Again, one has to wonder why
someone asks for this and specifically mentions a documented technical
limitation of the obvious answer to the question.
Since ->can, like ->DOES and any other way of enabling subroutines
which are not part of a class to make 'control flow descision' based
on the 'type' of some object shouldn't really exist to begin with (the
point of overloading is to eliminate explicit 'switching based on type
fields'), that's a small cost to pay.
A relatively trivial implementation is possible but I won't provide an
example here since this would be asking for another 'sideline
offensive'.
AUTOLOAD. The fact that UNIVERSAL->can and AUTOLOAD don't play nice
with each other is actually documented. Again, one has to wonder why
someone asks for this and specifically mentions a documented technical
limitation of the obvious answer to the question.
Since ->can, like ->DOES and any other way of enabling subroutines
which are not part of a class to make 'control flow descision' based
on the 'type' of some object shouldn't really exist to begin with (the
point of overloading is to eliminate explicit 'switching based on type
fields'), that's a small cost to pay.
A relatively trivial implementation is possible but I won't provide an
example here since this would be asking for another 'sideline
offensive'.