Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: RFC: Version::Easy

by jcb (Parson)
on Jul 12, 2020 at 03:45 UTC ( [id://11119197]=note: print w/replies, xml ) Need Help??


in reply to RFC: Version::Easy

This is an interesting little bundle of magic, but is use version; our $VERSION = version->declare('VERSION_GOES_HERE'); really that hard to write?

Similarly, maybe this should go one step farther and accept the version as an argument to import? Then users could write:

use Version::Easy 'v1.2.3';

This would abstract the magic $VERSION variable away into an implementation detail.

Replies are listed 'Best First'.
Re^2: RFC: Version::Easy
by tobyink (Canon) on Jul 12, 2020 at 07:11 UTC
    use Version::Easy 'v1.2.3';

    This has the disadvantage that static parsers like the PAUSE indexer won't be able to find the version.

Re^2: RFC: Version::Easy
by LanX (Saint) on Jul 12, 2020 at 13:20 UTC
    Like I already said and Toby explained, backwards compatibility to static parsers is a crucial issue here, and

    version->declare('VERSION_GOES_HERE')

    would become just another tribal knowledge.

    You'll find $VERSION also documented in hundreds of places, fixing old documentation is one of Perl's biggest mortgages.

    Furthermore could "Version::Easy" be easily bundled into one master module to rule ehm use them all, hence simplifying boilerplates.

    Compare Modern::Perl.

    Of course a built-in feature

    vers v1.2.3;

    might be more elegant, but this could easily be introduced later on top of this semantics once the tool chain is modernized.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      There's already a built-in version syntax from Perl 5.14 onwards.

      package Foo::Bar 1.23; ...; # or package Foo::Bar 1.23 { ...; }

      And the PAUSE indexer, etc supports it. It's only a problem if you need to support Perl versions earlier than 5.14.

        > There's already a built-in version syntax from Perl 5.14 onwards.

        package Foo::Bar 1.23;

        from package

        > If VERSION is provided, package sets the $VERSION variable in the given namespace to a version object with the VERSION provided.

        (emphasize added)

        so apparently I've just implemented the same semantic for older versions

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11119197]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-04-19 03:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found