Naming of new lazy versions of existing Phobos functions

Dmitry Olshansky via Digitalmars-d digitalmars-d at puremagic.com
Sat Jul 19 12:05:45 PDT 2014


19-Jul-2014 04:05, Brad Anderson пишет:
> 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.

+1

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list