[racket] Looking for guidelines regarding paths...

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Sat May 12 13:03:32 EDT 2012

Don Green wrote at 05/12/2012 12:44 PM:
> Maybe I need to understand why Racket is using the path form instead 
> of the string form. (Can you explain briefly why the string data type 
> was not sufficient so the path data type was developed.

I suspect that "path" abstraction was created a means for manipulating 
file pathnames in a way that is cross-platform and also less prone to 
error than using strings.

What I do in my code is to have my procedures accept both file pathnames 
in both "path" and string form, and to produce file pathnames as 
"path"s.  This just works, and is the idiomatic way to do it.  It also 
means that you have to use "path->string" sometimes, such as if you are 
writing pathnames to text files, but that has seemed an OK burden to me.

The main situation in which I would reconsider is if I were implementing 
something like a filesystem in Racket, and I wanted to double-check the 
performance.  I'd still see an advantage to "path", for 
correctness/robustness.

-- 
http://www.neilvandyke.org/

Posted on the users mailing list.