Naming of new lazy versions of existing Phobos functions
Brad Anderson via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jul 18 17:05:54 PDT 2014
To summarize what I think are the best ideas so far:
std.string
----------
Eager Lazy
----- ----
capitalize capitalized
center centered
detab detabbed
entab entabbed
format formatted
leftJustify leftJustified
munch munched
outdent outdented
removechars charsRemoved
rightJustify rightJustified
splitLines (none, uses splitter)
squeeze squeezed
strip stripped
stripLeft leftStripped
stripRight rightStripped
succ successor
toLower lowercased
toStringz nullTerminated
toUpper uppercased
translate translated
wrap wrapped
std.path
--------
Eager Lazy
----- ----
absolutePath absolutePathOf *
buildNormalizedPath asNormalizedPath *
buildPath asPath *
defaultExtension withDefaultExtension *
dirName dirNameOf *
driveName driveNameOf *
expandTilde tildeExpanded
relativePath relativePathOf *
setExtension withExtension
stripDrive driveStripped
stripExtension extensionStripped
* - not terribly happy with these but I'd say it's the best of
what's been proposed
Generally it seems like past tense works when the function has a
verb, "with" prefix when there is no verb but you are modifying
something about the input, and "Of" suffix when you are pulling
something out. Also, the verb should come last because it has a
better ring to it.
More information about the Digitalmars-d
mailing list