From: Josef W. <jw...@ra...> - 2013-09-27 19:20:24
|
On Do, Sep 26, 2013 at 11:52:48 +0300, Nikodemus Siivola wrote: > On 13 September 2013 17:23, Josef Wolf <jw...@ra...> wrote: > > 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))) > > That's a very good idea, but breaks backwards compatibility of a > public interface. Thanks for considering such a change, Nikodemus! I have not thought about compatibility. > a) keep the current lambda list but allow passing NIL as the first > position argument (FUNCTION) and add the keyword arguments you > propose. > > b) implement the API you propose under a different name. > MAP-DIRECTORY*, MAP-DIRECTORY-BY-KIND, etc. One could even consider to do both. Something like this: (defun map-directory (function directory &key (directory-function function) (file-function function) (symlink-function nil) (files t) (directories t) (classify-symlinks t) (errorp t)) (let ((ff (and files file-function)) (df (and directories directory-function)) (sf (and (not classify-symlinks) symlink-function))) (map-directory-by-kind directory :directory-function df :file-function ff :symlink-function sf :errorp errorp))) Do you think that would be too confusing to the user? > I look forward to seeing the patch on sbcl-devel! :) Yeah, I'm willing to give it a try. But we should sort out which way to go before implementing it. What do you think about passing the kind of the directory entry to the called function? Would that be possible without breaking compatibility? Multiple values maybe? But this would only be an issue with variant a), I guess. -- Josef Wolf jw...@ra... |