Despite my throw-it-over the transom comments on global vars, that's
not really why I came here (tho I will pitch in on the topic).

The perl features that most bites me in the ass is how module versioning
and searching works.  The easiest way to describe what I want is by
examples, so here are several of them.  And yes, I'm volunteering to
write the RFC -- but consider this note a request for any other ideas
or requests which came up before I was paying attention.  Like, say,
before Monday of last week.

Recovery from discovery of older versions:


Currently
  use  foo 1.2;
will fail if a version prior to 1.2 (including a versionless version)
is found in @INC.  Instead, perl should ignore any version which does
not match the users requirements.


Version Capping

One should be able to specify bottom and tops of version ranges, eg:

  use   foo "=<1.23";   # Any version up to and including 1.23
  use   foo "<1.23";    # Any version prior to 1.23
  use   foo "==1.23";   # Version 1.23 and only version 1.23
  use   foo "=>1.23";   # Any version from 1.23 forward
  use   foo ">1.23";    # Any version after 1.23

Do we want to require the quotes?  I dunno, see below.


Version Listing, Ranging

One should be able to specify any of a range of versions:

  use   foo 1.0 .. 2.0  # standard perl range syntax
  use   foo 1.0 ... 2.0 # standard perl range syntax
  use   foo 1.0..2 ;    # Barewords are interesting - is this a
                        # missing 3rd-level var, or a range?
                        # IMHO, it's an error - dots should balance
  use   foo 1.0..2.0    # But this is OK, 1.0 .. 2.0

or a list of versions:

  use   foo 1.0,1.1,>1.3;

Versioning in namespaces/modules:

Let us suppose that module foo requires module bar v1.0, while module
baz requires module bar 2.0.  This should be permitted, eg:

    foo.pm                              baz.pm

    use bar '==1.0';                    use bar '==2.0' ;

    bar::op();      # Uses bar 1.0 op   bar::op();      # Uses bar 2.0 op
    bar::1.0::op(); # Same              bar::2.0::op(); # Same

In general, if a version-qualified use of a package is done, it must
be with the version explicitly loaded.

This implies one could do:

    use bar 1.0 ;
    use bar 2.0 ;

    bar::op() ;      #Uses highest version loaded
    bar::1.0::op() ; #Same
    bar::2.0::op() ; #Same

IMHO, this opens incredibly ugly cans of syntatic and semantic worms.
However, IMHO it has to be allowed -- the bar::version packages are
treated as if they had separate names.  Why?  Because we want foo.pm
amd baz.pm to work right when the mainline says:

    my $handle1 = new foo ;
    my $handle2 = new bar ;
    my $var1 = $handle1->op();  # Always gets op 1.0
    my $var2 = $handle2->op();  # Always gets op 2.0

Clearly both versions must be loaded simultaneously, and we need the
possibility of that main going on to do

   my $opval1 = op::1.0() ;
   my $opval2 = op::2.0() ;

Note this might prove to be invaluable in testing new versions of modules.


General notes:

Subversion defaults should be well-defined - does "<=2.0" succeed or
fail with "2.0.1"?  IMHO any unspeicifed ranges should be assumed to
be `0', then the >/=/< applied.  Thus 2.0.1 would not satisfy "<=2.0".

And that's my over-the transom thoughts on the matter.

Reply via email to