develooper Front page | perl.perl5.porters | Postings from July 2020

Re: Dual-life perl 5-or-7 code and prototypes - impossible?

Thread Previous | Thread Next
From:
Todd Rinaldo
Date:
July 1, 2020 12:31
Subject:
Re: Dual-life perl 5-or-7 code and prototypes - impossible?
Message ID:
9B6025BB-F973-4926-8310-ED70885221DE@cpanel.net
There's also 

no if $] >= 7 feature 'signatures';

I agree that's probably the best way to go. It's a technical debt that makes sense to put off for another day. The same goes for Test2 prototypes.

Todd

> On Jun 30, 2020, at 2:56 PM, Kent Fredric <kentfredric@gmail.com> wrote:
> 
> On Sat, 27 Jun 2020 at 23:45, Paul "LeoNerd" Evans
> <leonerd@leonerd.org.uk> wrote:
>> 
>> TL;DR: I believe it impossible to write a dual-life module using
>>  function prototypes that works on both perl 5 and perl 7.
> 
> There may be an easier, and inherently more portable and compatible
> option, assuming of course, perl7 never deprecates the ability to `no
> feature qw(signatures)`
> 
> ( in say, List::Utils )
> 
> BEGIN {
>    if ( $] >= 7) {
>        require feature;
>        feature->unimport('signatures');
>    }
> }
> 
> I've synthetically demonstrated this currently works on perl5.
> 
> https://gist.github.com/kentfredric/875a5d2f9d56a7438669cbabfdc3b885
> 
> Surely I must have missed something obvious.

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