Proposal for std.path replacement

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Sun Mar 6 13:21:18 PST 2011


On Sun, 06 Mar 2011 09:29:27 -0600, Andrei Alexandrescu wrote:

> On 3/6/11 6:31 AM, Lars T. Kyllingstad wrote:
>> In summary, it seems currentDirSymbol, baseName, dirName and driveName
>> are clear winners.  Less clear, but still voted for by the majority,
>> are extension and stripExtension.  It is a tie between dirSep and
>> dirSeparator.
>>
>> Below are the votes I counted.  And before you say "hey, I didn't know
>> we could make suggestions of our own", or "why did that guy get several
>> votes?", this was by no means a formal vote.  It was just trying to get
>> a feel for people's preferences.  Before the module gets accepted into
>> Phobos there will have to be a formal review process, so there is still
>> a lot of opportunity to fight over naming. :)
> 
> I think whatever you choose will not please everybody, so just choose
> something and stick with it. Regarding all the extension naming stuff, I
> suggest you go with the "suffix" nomenclature which is more general and
> applicable to all OSs.

I don't agree.  A suffix can be anything, and we already have functions 
in std.algorithm, std.array and std.string to deal with the general 
case.  Like it or not, filename extensions are still the main method for 
conveying file type information on Windows (and even to some extent on 
Linux and OSX).  I think that's a good reason to include support for 
manipulating extensions in std.path.


> Regarding semantics, consistently strip the trailing slash. It is
> unequivocally the best semantics (and incidentally or not it's what
> Unix's dirname and basename do). If rsync et al need it, they can always
> look for it in the initial parameter. The reality of the matter is that
> you will never be able to accommodate all use cases there are with
> maximum convenience.

I agree, and that's how I've done it.


> You may want to prepare this for review after April 1st, when the review
> for std.parallelism ends. There is good signal in the exchange so far,
> but from here on this discussion could go on forever and shift focus
> away from std.parallelism.

Absolutely.  This was only intended as informal discussion, and not as a 
start on the formal review.

-Lars


More information about the Digitalmars-d mailing list