renamepalooza time

Lutger Blijdestijn lutger.blijdestijn at gmail.com
Fri Jan 21 00:43:36 PST 2011


Andrei Alexandrescu wrote:

> The following symbols in std.string don't satisfy the Phobos naming
> conventions and need to be renamed:
> 
> LS PS capwords countchars entab expandtabs hexdigits icmp iswhite
> ljustify lowercase maketrans newline octdigits removechars rjustify
> sformat splitlines stripl stripr tolower tolowerInPlace toupper
> toupperInPlace tr whitespace zfill
> 
> Opinions on what to rename?
> 
> 
> Thanks,
> 
> Andrei

Are there any conventions beyond what case to use?

I see this common pattern: verb-noun (expand-tabs) but for what I think is 
called adverbs in English it is a bit mixed (ljustify vs stripl).


These ones should be simply lower camel case:

capwords countchars entab expandtabs hexdigits octdigits removechars tolower 
tolowerInPlace toupper toupperInPlace lowercase maketrans splitlines


newline and whitespace: not sure how it is called in English, but these look 
like they have become single words and are fine.

LS and PS: since these are constants, upper case is ok, although LS is 
inconsistent with std.path.linesep. 

iswhite -> isWhitespace

tr: would say translate, but it's already there. Doesn't it overlap too 
much?

Then these remain, I'm less sure about them:

icmp ljustify rjustify sformat stripl stripr zfill

Possibly:

icmp: ok, it's a single abbreviation and insensitiveCompare is too much
ljustify -> leftJustify
rjustify -> rightJustify
sformat -> stringFormat (?)
stripl -> leftStrip
stripr -> rightStrip
zfill -> zeroFill (or better, ditch it and overload justify to take the 
filling char)


More information about the Digitalmars-d mailing list