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

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

Thread Previous | Thread Next
Tony Cook
November 26, 2020 00:34
Re: Looking for someone to adopt adding trim() to core
Message ID:
On Wed, Nov 11, 2020 at 04:01:47PM +0100, demerphq wrote:
> Why does it need to be added to the language as a new keyword? You
> could add it via universal.c to the SCALAR namespace (for example) and
> have it accessible without any feature horribleness. I believe we have
> already approved that such namespaces are acceptable. And additions to
> them do not need any feature bodge and are trivially made backwards
> compatible.
> print SCALAR::trim($str);
> I vote "no" to this as a feature. But I am fine with it being in core
> via universal.c and the right namespace.

The same arguments could be made for fc(), say() and evalbytes().

I'm a bit on the fence with trim() in particular, but tend slightly
towards including it.  I think it would see more usage than chop() for

I don't recall any discussion about a SCALAR namespace or anything
similar (though there was mauve IIRC).

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).


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About