develooper Front page | perl.perl5.porters | Postings from September 2011

Re: [ #70622] Versions Disappear

Thread Previous | Thread Next
David Golden
September 8, 2011 10:51
Re: [ #70622] Versions Disappear
Message ID:
On Thu, Sep 8, 2011 at 12:23 PM, David E. Wheeler <> wrote:
> On Sep 8, 2011, at 9:03 AM, David E. Wheeler wrote:
>>> $ perl -E'package Foo 1.23; say ref($VERSION)'
>>> version
>> +1
>> Okay then!
> Er, although:
>    > perl -E'package Foo 1.23; say ref(Foo->VERSION)'
>    > perl -E'package Foo v1.23.0; say ref(Foo->VERSION)'
> Wha?

I think that goes back to my point that Foo->VERSION should return
whatever is in $Foo::VERSION without modification.

As I consider UNIVERSAL::VERSION, the only reason I can think for it
to exist at all is to allow version checks equivalent to a "use NAME
VERSION" call.  E.g.

    use Foo 1.23;

    use Foo;

We would like to have the argument to VERSION treated as close as
possible to the semantics of a version check as part of use() -- which
isn't easy as use() gets some custom parsing.  This explains why
VERSION requires both $Foo::VERSION and the argument to VERSION to be
sane (lax) version number -- it's matching the semantics of "use Foo
1.23" which would blow up for "use Foo 3crap" or "$Foo::VERSION =

To say that differently -- VERSION requires things to be upgradeable
to version objects not because version objects are inherently
desirable in themselves, but because it's what happens internally
during "use NAME VERSION" checks.

Having UNIVERSAL::VERSION return a useful value was probably a poor
API choice in retrospect.

-- David

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About