std.uni.toLowerCase / .toUpperCase

Mike Parker via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 25 22:24:34 PDT 2015


On 6/26/2015 5:04 AM, Tofu Ninja wrote:
> On Thursday, 25 June 2015 at 13:04:12 UTC, Vladimir Panteleev wrote:
>> So, one option is to stay consistent with these additions, and go with
>> upperCaser and lowerCaser, even if those sound a bit odd.
>
> Why not upperCaseSetter/lowerCaseSetter? Bit longer but upper case and
> lower case don't have a good noun version. Personally
> upperCaser/lowerCaser sound really bad to me, though I like the idea of
> keeping it a noun because that matches every thing else.

I think upperCaser and lowerCaser are just fine. And I'm saying that as 
someone who has been teaching English in Korea for a couple of decades 
:) No, these aren't words we would normally use. But a couple of points.

1. An -er suffix is immediately recognizable in most cases as "a thing 
that takes an action." Native English-speaking children and, in my 
experience, non-native speakers often tack it on to verbs to create a 
"doer" noun even when a different word already exists. A great example 
is "cooker" to refer to a "cook". It's well-understood from that 
perspective.

2. English is full of broken conventions, making it more onerous to 
learn vocabulary than it ought to be. I think we should pick an 
easily-understood convention that fits the usage of whatever category of 
functions we're dealing with and stick with it as zealously as possible, 
even if it means using words that aren't part of the language or that 
don't look so pretty when they are strung together. Doing so makes it 
much easier to reason at a glance about what's going on.

upperCased/lowerCased work fine for strings that have already been 
transformed, but ranges that carry out the transformation are more 
accurately named upperCaser/lowerCaser. IMO, that's the simplest, most 
self-descriptive name these functions could have.


More information about the Digitalmars-d mailing list