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