From: Pascal J. B. <pj...@in...> - 2011-05-03 18:47:26
|
Sam Steingold <sd...@gn...> writes: >> * Zach Beane <knpu@knpu.pbz> [2011-05-03 10:41:59 -0400]: >> Sam Steingold <sd...@gn...> writes: >> >>> "foo*" is a valid (although uncommon) pathname on most modern OSes but >>> it cannot be handled by clisp easily. >>> proposal: user variable *accept-wild-pathname* which will treat wild >>> pathname as non-wild in OPEN, DELETE-FILE et al.: >> >> Some other CLs handle this by interpreting a precding #\\ as a desire to >> inhibit processing the following character as a wildcard. Deleting the >> file in your example would look like: (delete-file #p"foo\\*"). >> >> This has the effect that the namestring of the pathname does not map >> exactly to the underlying filename. SBCL provides a NATIVE-NAMESTRING >> function to get it instead. > > I think my solution is simpler, cleaner, and more ANSI-compliant. > Your solution adds an extra (non-standard, i.e., non-compliant!) quoting rule. Both solutions are non-standard, but both can be used to write a conforming program, since they're both conforming implementation dependant behaviors, as long as they're documented. Any string introduced by #P, that is not in the logical pathname syntax, is parsed in an implementation dependant way. There's no problem with an implementation that parses \\* to mean a literal #\* instead of a :wild card. This is my prefered solution, since clisp already parses #\~ in an implementation specific way in namestrings. > I think the simplicity wins. >From the point of view of the users (both programmers and end-users), #P"foo\\*" is simplier to use than binding special variables. Foremost, it can be used with libraries without ill side effects. > BTW, should the strict *ANSI* mode set this to NIL? > I think it should, so the name must end with -ANSI* > So, it should be *wild-pathnames-ansi*, right? Parsing non-logical pathnames is implementation dependent anyways. I'm not sure there's value in multiplying the options and alternatives. #P"dir\\**/foo\\\*" should let you open the file named "dir**/foo\\*". -- __Pascal Bourguignon__ http://www.informatimago.com/ A bad day in () is better than a good day in {}. |