Proposal for std.path replacement

Jonathan M Davis jmdavisProg at gmx.com
Sun Mar 6 04:24:13 PST 2011


On Sunday 06 March 2011 04:11:35 Lars T. Kyllingstad wrote:
> On Sat, 05 Mar 2011 14:33:07 -0800, Jonathan M Davis wrote:
> > On Saturday 05 March 2011 08:32:55 Lars T. Kyllingstad wrote:
> >> 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 and pathSep. Having Separator in the name is unnecessarily long.
> > 
> >>  * currentDirSymbol, currentDirSym, curDirSymbol
> > 
> > currDirSym and parentDirSym (and currDirSymbol and parentDirSymbol if
> > abbreviating both current and symbol is too much). Shorter but still
> > quite clear.
> > 
> > I would _definitely_ use two r's when abbreviating current though, since
> > current has two r's. I confess that it' a major pet peeve of mine when I
> > see current abbreviate with one r. It feels like it's being spelled
> > wrong, since current has two r's.
> > 
> >>  * basename, baseName, filename, fileName
> > 
> > baseName
> > 
> >>  * dirname, dirName, directory, getDir, getDirName
> > 
> > dirName
> > 
> >>  * drivename, driveName, drive, getDrive, getDriveName
> > 
> > driveLetter would probably be better actually - though it _could_ be
> > more than one letter if someone has an insane number of drives (it's
> > usually referred to as a drive letter though). Barring that, drive would
> > be fine (as long as it's a property).
> 
> Interestingly, it seems drive names are actually restricted to one
> letter.  See the last paragraph of this section:
> 
> http://en.wikipedia.org/wiki/Drive_letter#Common_assignments

I could have sworn that I'd seen something which allowed you to assign two-
letter names to drives instead of just one...

Oh well, it's not like two-letter drive names would be common anyway. That just 
seems like driveLetter is that much better a name though - especially since 
driveLetter is unambiguously a Windows thing then as opposed to some general HDD 
thing.

- Jonathan M Davis


More information about the Digitalmars-d mailing list