std.string.entabber, detabber, left/right/centerJustifier, soundexer

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 2 04:04:50 PDT 2015


On Thursday, 2 July 2015 at 08:48:42 UTC, ixid wrote:
> They're nicer without either 'er' nor 'ed'.
>
> writeln(str.lowerCase.detab.transmogrify);
>
> Just as join and split are much better than the rather tortured 
> joiner and splitter. That may be a cutter but I want it to cut, 
> and would rather invoke it that way. The er and ed carry no 
> useful information and sound clunky. A man may be a mower but 
> I'd ask him to mow the field.

Well, for one, splitter and joiner don't do any splitting or 
joining - they simply return a range type which does so as you 
iterate over it, so that "er" is actually very related to what 
they're doing, and split and join would arguably be misnomers, 
since that implies that they actually split or join the input 
(which they don't). On the other hand, the split and join 
functions - which are eager - very much deserve their names, 
since the _do_ split and join their input respectively.

And for two, in the cases of the new functions that have been 
added recently which triggered this discussion in the first 
place, eager versions already exist which have verb names like 
you're looking for, so we have to use new names even if we wanted 
to use names like you're suggesting. So, if we were going to just 
use verbs like before, we'd have to come up with completely new 
names. And when splitter and joiner were added, split and join 
already existed, so new names were needed. So, we already have a 
precedent for adding "er" for functions which return lazy ranges, 
and it makes perfect sense to do so given that they're simply 
returning objects which do the action rather than doing the 
action themselves. They're actually more like constructors than 
normal functions.

- Jonathan M Davis


More information about the Digitalmars-d mailing list