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 26, 2005 10:59
Subject:
Re: Syntax of using Perl5 modules?
Message ID:
42960E8C.9060101@rodadams.net
Adam Kennedy wrote:

>> On the migration front, when someone ports Digest.pm to Perl6, I get 
>> a "free" upgrade, assuming the module author was kind enough to up 
>> the version number.
>
>
> You are making a pretty huge assumption here that whoever has a 
> namespace in p5 CPAN has first dibs at the P6 namespace of the same 
> name, and that they will do a straight port over.
>
> Someone else could reimplement the module for Perl 6, or perhaps the 
> author wants to (desperately needed in some cases)completely overhaul 
> the module and API based on lessons learnt the first time.
>
> The problem with automatic fallback is simple that you are no longer 
> getting two different versions of the same module, you are getting two 
> completely different libraries, with no guarentee that the API is 
> consistent.
>
> Automatic fallback lets changes in environment leak into the process 
> and cause unexpected changes in program functionality, and this is BAD.
>
> The only time at which having to do nothing to load a current CPAN 
> module will be during the transition period, before a suffucient body 
> of Perl 6 modules have built up.
>
> In the longer run, much better to have to do something special to get 
> the old and redundant versions of modules.
>

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".

I believe the ability to specify what versions and/or authors of the 
module you find permissible in p6 can completely resolve your issues. If 
you care about getting an exact version of a module, ask for it, and 
you'll get it or die.

In p5, your only options were to 1) not install the new version 2) 
install it, and globally update your code to match, 3) give each script 
it's own libpath.

I still think auto fallback makes sense. If you don't like it, always 
fully specify your "use" statements. See S11 for details.

-- 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