|
From: Josef W. <jw...@ra...> - 2013-09-13 14:48:30
|
Hello everybody, while browsing through http://www.sbcl.org/all-news.html, I found the new SB-EXT:MAP-DIRECTORY function, which would come very handy in a project I am planning to port from perl to CL. I think this new feature could be improved considerably by a little change of its lambda-list: (defun map-directory (directory &key (directory-function nil) (file-function nil) (symlink-function nil) (errorp t))) If no symlink-function is given, behaves like :classify-symlinks t If defined this way, the invocation in DELETE-DIRECTORY could be reduced to: (map-directory dir :directory-function (recurse-merged dir) :file-function (delete-merged dir) :symlink-function (delete-merged dir)) With this change, MAP-DIRECTORY would be called only once, eliminating opportunities for race conditions. (at least theoretically) One more improvement would be if MAP-DIRECTORY would pass to the callee what kind of file (dir, file, whatever) the current entry is. For symlinks, this would be the kind of the link-target. Any opinions? PS: Making traversals _safe_ is a totally different topic, of course. -- Josef Wolf jw...@ra... |