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

Re: [rt.cpan.org #70622] Versions Disappear

From:
David E. Wheeler
Date:
September 6, 2011 10:14
Subject:
Re: [rt.cpan.org #70622] Versions Disappear
Message ID:
DEE5FD88-8966-454B-B95B-518482F31C84@kineticode.com
On Sep 5, 2011, at 12:35 PM, David Golden wrote:

> Excerpt from <http://www.dagolden.com/index.php/369/version-numbers-should-be-boring/>:
> 
>  $ perl5.8.8 -e '$VERSION=v120.100.103; print main->VERSION'
>  xdg
> 
>  $ perl5.10.0 -e '$version=v120.100.103; print main->version'
>  v120.100.103

Gotta admit that the 5.10.0 behavior feels much saner to me.

>  [...]
> 
>  $ perl5.8.8 -Mversion -e '$VERSION=v120.100.103; print main->VERSION'
>  v120.100.103
> 
>  Think about the implications of that for a module called 'Foo'. Even if
>  Foo doesn't use version.pm, if version.pm is loaded anywhere then
>  Foo->VERSION acts differently and gives a different value than is in
>  $Foo::VERSION.
> 
> *Any* code written expecting the 5.8.8 behavior of ->VERSION breaks in
> 5.10.0 or even in 5.8.8 if version.pm (prior to 0.92) is loaded by
> *any* module.

Yeah, that's clearly wrong. version.pm should not change global behavior like that. UNIVERSAL::VERSION should do its own thing IMNSHO.

> Sure, knowing all this, *you* could now choose to fetch $Foo::VERSION
> or Foo->VERSION, but prior to Perl 5.10.0, no one thought they did
> anything different, so I don't think it's a good idea to impose new
> semantics on old code simply for the convenience of today's coder, and
> certainly not without the deprecation cycle provided for in
> perlpolicy.
> 
> I agree that it's a sorry state of affairs, but on this issue, I'm
> (perhaps shockingly?) in the do-no-harm backward compatibility camp.

But how much has it been complained about, really? I mean the change in behavior of UNIVERSAL::VERSION, not version.pm injecting global behavior, of course. It has been almost 3 years since 5.10.0 dropped.

Best,

David





nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About