[m-rev.] for review: library changes for `mmc --make' on Windows

Simon Taylor stayl at cs.mu.OZ.AU
Tue Jul 15 16:01:23 AEST 2003


On 15-Jul-2003, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 23-Jun-2003, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> > 	% dir__split_name(PathName, DirName, BaseName)
> > 	% Split a filename into a directory part and a filename part.
> > 	% Fails for root directories and filenames not containing
> > 	% directory information.
> > 	% Trailing slashes are removed from PathName before splitting.
> > :- pred dir__split_name(string, string, string).
> > :- mode dir__split_name(in, out, out) is semidet.
> > 
> > 	% dir__dirname(PathName) = DirName
> > 	% Extract the directory part of the given filename.
> > 	% Fails for root directories.
> > 	% Returns "." for filenames not containing directory information.
> > 	% Trailing slashes are removed from PathName before splitting.
> > :- func dir__dirname(string) = string is semidet.
> 
> The documentation for these two should be more explicit about if/when
> DirName will contain a trailing slash.
> 
> Also, the documentation for dir__make_path_name/2 (a.k.a. '/'/2)
> should be more explicit about what happens if the first argument
> does / does not contain a trailing slash (or, for that matter,
> what happens if the second argument contains slashes).
> 
> If dir__dirname("foo/bar") returns "foo/" (note trailing slash),
> then presumably dir__dirname("./bar") returns "./",
> so shouldn't dir__dirname("bar") return "./" too, rather than "."?

We're coming at this from different angles. My opinion is that
a path name should conceptually be an abstract type. Any user
code depending on the presence or absence of slashes on the end
of a directory name is broken.  In the same way, user code can't
assume anything about directory separators in the paths returned
from the dir module.

Simon.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list