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:
demerphq
Date:
February 15, 2021 08:19
Subject:
Re: Looking for someone to adopt adding trim() to core
Message ID:
CANgJU+VhPBs-MJg85XY1u1n3s1kmq3R5jhMVDY1V33wm-MQp4w@mail.gmail.com
On Wed, 25 Nov 2020 at 11:35, Christian Walde <walde.christian@gmail.com> wrote:
> I already explained elsewhere in this thread why Yves' concerns do not apply to trim specifically

I didnt see any explanation that I found convincing, sorry.

Given a quick survey on this point the simplest solution is for us to
agree what built in namespace this should live in and move on.

As long as you or anyone else's argument that it should be added to
the *language* as a keyword, I will object strenuously, and so will
others.

The *bad* precedent set in the past with having every function for
everything in the same namespace which is in competition with user
defined functions is not a precedent to use to justify adding a new
one. In fact we do a bunch of weirdo games so the "language" functions
are shared between namespaces, so in reality they are actually special
cases, exceptions to the rules of how namespace management works.
Perl doesnt need more exceptional crap. It has all the basic tools to
be extendable into the future without needing new keywords added to
the language. So let's use them and stop trying to add new exceptional
behavior. It causes trouble, usually subtle trouble that the people
pushing these solutions haven't demonstrated clearly that they have
thought through -- new keywords via features are *imherently* not
backwards compatible for example,  and they make supporting broadly
used modules a pain in the ass.

The reason we can't have nice new things in Perl is because we get
fixated on issues like this. You want trim in the core, fine, put it
in SCALAR::trim(). Then make a module that exposes it or a backcompat
implementation to people via exporter semantics. If you keep pushing
it to be part of the language IMO this argument will be going on 5
years from now.

The only difference is that people will have to write "SCALAR" or
"scalar::" (whatever bike shed color we choose), its a bit ugly, but
entirely within precedent, and it doesn't have any back compat/forward
compat issues at all.  You can trivially "shim" it into the right
place in older perls, and you can trivially import it to your
namespace with

BEGIN { *trim=*scalar::trim; }

or the Exporter wrapper that you could write. How would you do that
with "use feature" and a new keyword?

cheers
Yves


-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

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