develooper Front page | perl.perl5.porters | Postings from February 2022

Re: trim vs trimmed revisited

Thread Previous | Thread Next
From:
Yuki Kimoto
Date:
February 24, 2022 07:33
Subject:
Re: trim vs trimmed revisited
Message ID:
CAExogxOJjH=3wBwqzyJ+mak8BuKvUMim9Kyd89JPupo0yMopfQ@mail.gmail.com
2022-2-24 12:44 Karl Williamson <public@khwilliamson.com> wrote:

> I believe using 'trimmed' is a mistake, and this email is a last ditch
> effort to make that case.
>
> There is zero precedent in the core for using a past participle to name
> a function that takes an argument and returns some perturbation of it.
> We do not have 'reversed' nor 'sorted', nor 'crypted' nor 'hexed' nor
> 'packed' nor 'absd' 'orded' 'lcfirsted' ...
>
> We do, however, have in fact some functions in the core whose names are
> a past participle: 'defined', 'tied', and just outside of core:
> Scalar::Util::blessed.  All these functions return a boolean, not at all
> like 'trimmed' would do.
>
> So 'trimmed' would actually be the sole member of a new class of names.
> I hear that there is some wish that 'sort' had originally been named
> 'sorted'.  But it wasn't, and making a new name that corresponds to that
> forlorn hope but violates all existing precedents will only sow confusion.
>
> When I was 13-ish, I learned in Math class that f(x) is pronounced 'f of
> x'.  That didn't change in my education all the way through getting a
> Bachelor's degree in Math.  Following along with that, I pronounce
>
> @x = sort(@y)
>
> as "Set x to the sort of y".  I suppose one could pronounce it as "x
> becomes the sorted version of y", but that's really not following
> standard English usage.
>
> My assertion is that 'trimmed' violates precedents in core Perl and in
> standard usage.
>
> I wish that the few functions that change their operand in place, like
> chomp, instead left the argument unchanged, and returned the
> transmogrified result.  But it's too late to change them; and they are
> outliers.  Hence, using them as a justification for 'trimmed' is wrong.
>
> And there maybe a better word than trim or its derivatives.  'trim' can
> mean both take away' and 'add'  I sew on trim as a border, or to trim
> the Christmas tree.
>
>
I don't have a strong request for function naming, but I feel "trim" is
good because the first Scott Baker suggested was "trim".

I also feel that PSC can respect the opinions of users.

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