Re: [Module::Build] version.pm and version number comparison problem
Status: Beta
Brought to you by:
kwilliams
|
From: Ken W. <ke...@ma...> - 2006-02-03 16:41:20
|
On Feb 2, 2006, at 10:52 PM, Chris Dolan wrote:
> On Feb 2, 2006, at 10:26 PM, Ken Williams wrote:
>
>> On Feb 2, 2006, at 10:18 PM, Chris Dolan wrote:
>>> Well, if it throws an exception, it's probably not a version
>>> instance, right?
>>
>> Why not? It could be a version instance that overloads isa() for
>> whatever satanic purpose it wants to, and throws an exception,
>> because it's evil and it can.
>
> I don't think version.pm is actually in league with the devil. :-)
I was referring to some possibly strange & unknown class that
subclasses version.pm.
> Presumably, version would only override isa() if it really, really
> needed to be overridden. Why should we ignore that decision that was
> probably made with great care?
Because IMO even if it was made with great care it's wrong. You can't
change perl's notion of what constitutes a subclass even if you do
override isa().
As I published in a review of UNIVERSAL::isa() last night, this is very
different from overriding can(). For can(), the author does have the
ability to override perl's dispatch of method calls via AUTOLOAD(), so
overriding can() is a good idea. For isa(), we can't override perl's
OO inheritance notions, so overriding isa() is a bad idea and will
leave the caller in a state of confusion over who's right, perl or
isa().
> No, that's not right. What you want to know is if the $version is not
> a plain scalar and therefore whether it needs to be numify()ed.
> isa('version') is a close proxy for that decision.
Just because it's not a plain scalar, though, doesn't mean it needs to
be numified. Theoretically someone has written their *own* class for
version objects, independent of version.pm, which they think is going
to handle things their own special way without use of a numify()
method.
In this case we really *do* want to know whether the $version inherits
from version.pm, because then it will have a published numify() method
with known semantics. If it's some other class, we know nothing.
-Ken
|