Andrew Pimlott wrote: > On Wed, Jul 26, 2006 at 05:06:41PM -0400, David Roundy wrote: > > This doesn't apply uniformly to all programs--except that we can say > > that any path with a trailing '/' is intended to be a directory, and > > if it's not, then that's an error. > > I thought some more about this, and I think the right way to handle this > is on parsing and printing.
Amen.
> After all, the trailing slash has no real
> meaning for any intermediate processing you might do.
Here I beg to differ. I'd expect:
*> setFileName "foo" "bar" == "bar"
*> setFileName "foo/" "bar" == "foo/bar"
In fact, that's consistent with the current documentation, because
*> getFileName "foo" == "foo"
*> getFileName "foo/" == ""
No matter whether I'm correct, whether my expectation is natural or
practical and whether others agree, the bahaviour has to be clearly
specified and the final slash certainly isn't unimportant.
> readPath :: String -> (Path, Bool {- trailing delimiter -})
> showPath :: Path -> String
> showPathTrailingSlash :: Path -> String
>
> This is far simpler than trying to figure out what the slash means for
> every path operation.
It's also far uglier... besides, it isn't about the slash, it is about
the difference between file and directory.
Udo.
--
If you cannot in the long run tell everyone what you have been doing,
your doing was worthless.
-- Erwin Schrödinger
signature.asc
Description: Digital signature
_______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
