On Monday, 22 June 2015 at 11:45:31 UTC, Wyatt wrote:
On Saturday, 20 June 2015 at 09:27:16 UTC, Vladimir Panteleev
wrote:
Two examples of controversial name pairs: setExt/setExtension,
and toLower/toLowerCase. These functions have the same
functionality, but one of them is eager, and the other is
lazy. Can you guess which is which
If I had to hazard a guess, I'd go with "the shorter one is
lazy", but that presumes I'd notice there were two
nearly-identical functions in the first place and pick up on
the not-well-conveyed implication that one is lazy and the
other is not.
Well, you'd be wrong. Although setExt is the lazy version of
setExtension, toLowerCase is the lazy version toLower. Who needs
consistency, eh?
And it's a bad thing everyone seems to be tip-toeing around,
too.
None of the suggestions I've seen so far really call out to me
"hey, this is lazy and has a non-lazy counterpart". Would it
be so wrong to add "lazy" to the beginning or end so it's super
obvious at a glance with zero cognitive overhead?
Just to reiterate, I want to stress that finding a perfect name
is of secondary concern to deciding to change the name in the
first place. A big part of the argument against renaming things
is "look how much debate there is about what it should be called,
it's obvious there is no consensus, let's just leave things as
they are".