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

Re: Naming the trim() variants (was Re: Let's talk about trim() somore)

Thread Previous | Thread Next
From:
Christian Walde
Date:
March 27, 2021 04:06
Subject:
Re: Naming the trim() variants (was Re: Let's talk about trim() somore)
Message ID:
op.00wa1e02ydyjqt@xenwide.vpn.udag.de
On Sat, 27 Mar 2021 04:58:11 +0100, Darren Duncan <darren@darrenduncan.net> wrote:

> On 2021-03-26 4:00 p.m., Christian Walde wrote:
>> Frankly, we just need someone from PSC to tell Scott to go ahead with the
>> latter, and put out a call figuring out the best combination of names. And i
>> find it ... less than optimal to string him along further like this.
>
> I have a proposal on the naming which fits my general sensibilities.
>
> Use trim() for the version which modifies its argument, and trimmed() for the
> version that doesn't and returns the result.
>
> The idea here is that the modify-argument is named with a verb, "trim" (short
> for "trim this"), because it "takes some action".
>
> And the non-modifying version is named with a noun or an adjective, "trimmed"
> (short for "trimmed version of this"), because it finds a value corresponding to
> the input sans bounding whitespace, and does not "do" anything.

Yep, this was recommended in the github issue and is one nice solution.

For those who haven't yet, this is a must read here: https://github.com/Perl/perl5/pull/17999 :)

(I have no particular opinion on triml and trimr, might be nice.)

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