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

Re: Perl 5.16 and Beyond.

Thread Previous | Thread Next
From:
Chris Prather
Date:
October 6, 2011 09:57
Subject:
Re: Perl 5.16 and Beyond.
Message ID:
CAEP+=B3=qVidpVojrNoAU3w0bSVow0gjovAFFC_AfN5BZagfzQ@mail.gmail.com
On Thu, Oct 6, 2011 at 10:46 AM, Tom Christiansen <tchrist@perl.com> wrote:
> "H.Merijn Brand" <h.m.brand@xs4all.nl> wrote
>   on Thu, 06 Oct 2011 16:20:03 +0200:
>
>> Will there be any difference between
>
>>   require 5.010;
>
>> and
>
>>   use 5.010;
>
>> ?
>
>> If the require means "5.10.0 or newer" and the use means what has been
>> discussed everywhere, I can live with any decision made :)
>
> There already is a big difference between use/require version number.
>
>        % perl -e 'use 5.10.0; say what'
>    vs
>        % perl -e 'require 5.10.0; say what'
>        Can't locate object method "say" via package "what" (perhaps you forgot to load "what"?) at -e line 1.
>
> or
>
>        % perl -e 'use 5.10.0; say "what"'
>        what
>    vs
>        % perl -e 'require 5.10.0; say "what"'
>        String found where operator expected at -e line 1, near "say "what""
>                (Do you need to predeclare say?)
>        syntax error at -e line 1, near "say "what""
>        Execution of -e aborted due to compilation errors.
>
> Which is somewhat curious.

I don't find it curious, because `use Foo;' and `require Foo;` do
different things. The first is documented as `BEGIN { require Foo;
Foo->import() }`. I would expect use 5.10.0 be equivalent to `BEGIN {
require 5.10.0; 5.10.0->import }` which you handwave with feature.pm a
bit you get `BEGIN { require 5.10.0; require feature;
feature->import(":5.10"); }`.

Jesse's plan to me has always been making versions roughly equivalent
to pragmas, that is loadable modules that alter the behavior of the
core.

-Chris

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