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

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

Thread Previous | Thread Next
From:
Paul "LeoNerd" Evans
Date:
November 26, 2020 01:04
Subject:
Re: Looking for someone to adopt adding trim() to core
Message ID:
20201126010425.78d5285e@shy.leonerd.org.uk
On Thu, 26 Nov 2020 11:34:16 +1100
Tony Cook <tony@develop-help.com> wrote:

> Ideally we'd have strings-as-objects, and we could add trim() as a
> method, which I think would be uncontroversial, but we don't have
> those, and I don't see a simple way to change it ("Foo"->trim already
> has a meaning).

Yeah; that's the core [pardon the pun] kicker right there. The fact
that method dispatch on a plain unblessed non-reference tries to use
the value as a string giving the name of a package to invoke a class
method on, means that regular scalars can't act as pseudo autoboxed
objects. Whereas there's at least much hope for allowing unblessed
array/hash references to do so (e.g. $array->push(@more) ).

So much that *could* have been achieved, were that not the case...

-- 
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk      |  https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/  |  https://www.tindie.com/stores/leonerd/

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