Proposal for std.path replacement
Nick Sabalausky
a at a.a
Sat Mar 5 12:57:10 PST 2011
"Lars T. Kyllingstad" <public at kyllingen.NOSPAMnet> wrote in message
news:iktojn$go0$1 at digitalmars.com...
> On Fri, 04 Mar 2011 08:14:44 -0500, Nick Sabalausky wrote:
>
>> "Lars T. Kyllingstad" <public at kyllingen.NOSPAMnet> wrote in message
>> news:ikofkc$322$1 at digitalmars.com...
>>> As mentioned in the "std.path.getName(): Screwy by design?" thread, I
>>> started working on a rewrite of std.path a long time ago, but I got
>>> sidetracked by other things. The recent discussion got me working on
>>> it again, and it turned out there wasn't that much left to be done.
>>>
>>> So here it is, please comment:
>>>
>>> http://kyllingen.net/code/ltk/doc/path.html
>>> https://github.com/kyllingstad/ltk/blob/master/ltk/path.d
>>>
>>>
>> I don't want to jinx it, but there seems to be a lot of agreement in
>> this thread. Seriously, how often does that happen around here? :)
>
> Not too often, so I take it as a good sign that I'm onto something. ;)
>
> The only disagreement seems to be about the naming, so let's have a round
> of voting. Here are a few alternatives for each function. Please say
> which ones you prefer.
>
> * dirSeparator, dirSep, sep
dirSep, But I'd be fine with the others too.
> * currentDirSymbol, currentDirSym, curDirSymbol
currDirSymbol, But I'd be fine with the others too.
> * basename, baseName, filename, fileName
baseName or baseFileName
Definitely not 'filename' because I frequently use that as a variable name.
Definitely not 'basename' because it's not camel-cased, and because the fact
that there's a unix command named 'basename' is completely irrelevent.
Patchwork naming "convention" is idiotic.
And I'm uncomfortable with fileName because despite it being much more
descriptive than baseName, it's too close to what I'd use as a common
variable name.
> * dirname, dirName, directory, getDir, getDirName
dirName or directory. But anything except 'dirname' is fine.
> * drivename, driveName, drive, getDrive, getDriveName
driveName or drive. But anything except 'drivename' is fine.
> * extension, ext, getExt, getExtension
ext. But the others are fine, too.
> * stripExtension, stripExt
stripExt, But either one is fine.
Well now everyone, I think that I would have to have to say to all of the
people here in this newsgroup that excess verbosity can and does (and would
continue to) harm readability every last bit as much as having 2 mny abbrs
wuld harm the readability of the name of a variable, or a function or really
any other custom-named identifier that may or may not exist in D, or in
Phobos, or in any code written in D, or really any other langauge regardless
if it happens to be a programming language or some other sort of a language
such as a human language.
More information about the Digitalmars-d
mailing list