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

Re: trim - wrapping up the discussion

Thread Previous | Thread Next
From:
hv
Date:
April 1, 2021 00:09
Subject:
Re: trim - wrapping up the discussion
Message ID:
202103312346.12VNk3P27769@crypt.org
neilb@neilb.org wrote:
:Summary of the picture
:
:Looking at CPAN, when people have wanted to trim a variable, they've been
:massively more likely to just use a regexp than either write their own
:function or use one from CPAN. But in plenty of cases they get it wrong.

Before anything else there'd be value in digging into this more - why do
they get it wrong, is there *anything* we could improve that would increase
their chances of getting it right?

If they're getting this wrong, chances are they're getting lots of other
regexps wrong, and adding a trim() function won't help for those other
cases.

:1. Two separate but similarly named functions. Names TBD.
:2. One trim() function that returns the trimmed string
:3. One trim() function that edits in place
:4. Leave it to CPAN
:5. Given we've missed the 5.34 boat, perform a wider review of text
:processing gaps in Perl, possibly resulting in a broader proposal, which
:might change how we think about trim.

4-ish: rather, leave it to regexps. But concentrate on improvements -
maybe only in docs, maybe also in the language itself - to increase the
chances people get these and other regexps right.

Hugo

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