chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Bug in canonical-path?


From: Alex Shinn
Subject: Re: [Chicken-users] Bug in canonical-path?
Date: Thu, 30 Oct 2008 21:00:00 +0900
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2.50 (darwin)

Hi,

Ivan Raikov <address@hidden> writes:

>    I have been meaning to port the Haskell FilePath library to
> Chicken, because I find its API to be quite elegant and better
> organized than the existing file name manipulation routines in
> Chicken. This discussion has prompted me to create the filepath egg,
> which is an almost verbatim transliteration of the Haskell code, with
> a few Chicken-specific idioms here and there. I have included a flag
> parameter, which can be used to enable "Posix" mode or "Windows"
> mode for path name parsing and manipulation. The Windows mode supports
> weird things like UNC names and is aware of the DOS reserved names
> (CON, PRN, etc). I would appreciate it if people look at it, as I
> would like to see some variant of this API supersede the existing
> Chicken path manipulation stuff.

Pathname handling routines is one of the few libraries I
spent a lot of time working on for common-scheme, so you may
want to look at that (I punted on Windows issues though).
PLT also has an extensive pathname handling library, which
handles all the Windows weirdness.

Your filepath port looks nice.  A few comments from what
I've skimmed so far:

* You're working with lists of characters instead of strings
  (logical since that maps directly to the Haskell).
  Working with them allows a convenient functional
  implementation but can be slow.

* Note if you work with substrings rather than character
  lists, you don't need to (and shouldn't) use utf8-strings,
  since path names are really just byte-vectors.

* The separator inserted for Windows is '\'.  Since Windows
  recognizes '/', would it be better to just use that for
  all cases?  (I don't know, I'm asking the Windows users).

* Some people expect path normalization to resolve
  symlinks.  This is a separate operation - both are useful,
  you should be clear to document that your version doesn't
  do this.

* A concept of the current directoy and resolving relative
  paths to that is important.

* Expanding ~user directories is useful.

* Version info is another thing sometimes included in
  pathname halding (see CL).


-- 
Alex




reply via email to

[Prev in Thread] Current Thread [Next in Thread]