develooper Front page | perl.perl5.porters | Postings from February 2021

Re: Looking for someone to adopt adding trim() to core

Thread Previous | Thread Next
From:
Christian Walde
Date:
February 15, 2021 14:53
Subject:
Re: Looking for someone to adopt adding trim() to core
Message ID:
op.0yu2avpkydyjqt@xenwide.vpn.udag.de
On Mon, 15 Feb 2021 12:44:58 +0100, demerphq <demerphq@gmail.com> wrote:

> [...]

Small update for the list, after this discussion was moved to IRC:


The impetus for backcompat stems from demerphq's company having banned feature.pm outright, making a way to implement it without using feature seemingly the only way to achieve access to it at all.


However, as of 5.16, feature functions are also available in CORE:: as per:

https://perldoc.pl/perl5160delta#The-CORE::-prefix


That means this works:

*x = *CORE::fc; x("AA");


That means both of these shim modules would work:

package Trim; BEGIN { *trim = ( $] >= $version ? *scalar::trim : sub { .... } ) };

package Trim; BEGIN { *trim = ( $] >= $version ? *CORE::trim : sub { .... } ) };

Thus demerphq's feature requirement is fulfilled regardless of which implementation is chosen.


That leaves the issue that this needs to work:

use 5.777;
say trim <>;

If the implementation is:
CORE:: - the path is already clear
scalar:: - some work is needed to figure out how to make it happen.


-- 
With regards,
Christian Walde

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