develooper Front page | perl.perl6.language | Postings from May 2005

Re: Syntax of using Perl5 modules?

Thread Previous | Thread Next
From:
Rod Adams
Date:
May 27, 2005 02:07
Subject:
Re: Syntax of using Perl5 modules?
Message ID:
4296E35A.1020505@rodadams.net
Adam Kennedy wrote:

>> You get all those possibilities whenever you install any new version 
>> of a module you get from someone else, regardless of a p5->p6 hop. In 
>> p6, when you say "use Digest;", you are specifically asking for what 
>> p6 considers the "latest" version. In p5, it was "first match on 
>> libpath".
>
>
> Except that within Perl 5, there is an general expectation that the 
> same API will exist across multiple module versions. It is assumed 
> that newer versions of a module will continue to work the same as 
> older ones, with API breakages being a bad and rare thing.
>
> The 6 month long mod_perl Apache::->Apache2:: argument was over this 
> very thing. There is a huge difference between an API version and a 
> module (implementation) version.
>
> As far as I'm aware, there is no expectation that *every* module in 
> Perl 6 that shares a name with a module in Perl 5 will merely be a 
> re-implementation of the same API in Perl6.
>
> If I am expected to reimplement all my Perl 5 modules in Perl 6 
> without the opportunity to do a better job and take advantage of new 
> Perl 6 API-related features, could someone please point my boot in the 
> general direction of the ass of whoever came up with that idea.
>
<soapbox>
Across all languages, libraries, modules, applications, operating 
systems, and most everything else in the computer world, I expect 
interoperability to remain mostly the same across minor version numbers, 
but anything goes when a new major version comes out. Now, I'm not 
terribly active in the CPAN arena, but I think it's short sighted to 
expect the API from version 1.1.5 to still be there in 2.7.1. This 
phenomenon is why it's fairly common to see the last minor version of 
the previous major version still around and available in many areas.
Major changes in usage and syntax are what major version jumps are all 
about.
</soapbox>

As an alternative, the URI field of the module version could be extended 
to have the API version mixed somehow, maybe "cpan:JRANDOM#1.5.6". But 
that gets non-intuitive and ugly very quickly.

Part of the p5 problem is that module upgrades were all or nothing. In 
p6, you'll be able to load both the old version and the new version, at 
the same time. Or just tell the old apps that you don't have time to fix 
to use versions < 2.0.0, and the new apps to use version >= 2.0.0.

Another part of the problem with p5 is that while there was the ability 
to spec a version in a 'use' call, it was only a lower bound. You 
couldn't specify an upper bound as well, to tell people that you weren't 
ready for a new API/semantics. (To my knowledge, _nobody_ overrides the 
VERSION method)


Personally, I would prefer having to track which major version number 
I'm using over the mess that's in CPAN, where it seems like the standard 
way to introduce a new API is to come up with a new name for the module 
that means the same thing. However, as I pointed out before, since in p5 
there is no notion of an author URI, haveing that become the string 
'perl5' makes sense, and could be matched against, both positively and 
negatively.

-- Rod Adams


Thread Previous | Thread Next


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