std.uni.toLowerCase / .toUpperCase

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 23 22:20:37 PDT 2015


On Tuesday, 23 June 2015 at 22:58:32 UTC, Vladimir Panteleev 
wrote:
> On Tuesday, 23 June 2015 at 22:45:10 UTC, Vladimir Panteleev 
> wrote:
>> A rename can be proposed by creating a subthread: [...]
>
> Rationale:
>
> As with setExt, std.uni already contains functions called 
> toLower/toUpper, thus the only difference in name is that the 
> implied word "Case" is omitted. The distinction is not 
> memorable.
>
> Proposed new name: lowerCased / upperCased

If we want to be consistent with the likes of splitter, then they 
should be something more like lowerCaser and upperCaser (though 
caser isn't really word, and AFAIK, there is no noun for 
something which changes the case of a letter). When adding lazy 
versions in the past, for better or worse, we've generally gone 
for using nouns, whereas you're suggesting adjectives based 
coming from the past tense of a verb (though the verb "to case" 
has nothing with the case of letters).

I'm not really a fan of having both toLower/toUpper and 
toLowerCase/toUpperCase - especially when the longer version is 
the lazy one - but lowerCased and upperCased are both ugly and 
don't follow any kind of convention that we've been using and 
don't follow a convention that I think we should use. Much as 
functions are normally verbs, it makes far more sense to me to 
have a function named after a noun than an adjective if it's 
returning a lazy range, since then you're essentially naming the 
function after the range (like a constructor).

So, if we're going to be more consistent, I think that following 
what we've done with splitter makes more sense, and while that's 
ugly in this case, what you're suggestion is just as ugly. And I 
think that I'd rather see the annoyance of having toLower/toUpper 
and toUpperCase and toLowerCase in the same module than start 
naming functions after adjectives - especially when the resulting 
name is ugly like it is here.

- Jonathan M Davis


More information about the Digitalmars-d mailing list