[alexandria-devel] remove-from-plist argument order
hi, Nikodemus, i've seen your comment regarding r-f-p. i have more or less copied r-f-p from arnesi and unfortunately didn't give it enough thoughts and therefore the current argument order just a heritage. the (r-f-p plist &rest keys) signature looks much better and performance can be have through inlining the calls, so i suggest to simply changing r-f-p to that signature, and recording the change with a big fat warning. -- attila
On Dec 19, 2007 4:25 PM, Attila Lendvai <attila.lendvai@gmail.com> wrote:
Nikodemus, i've seen your comment regarding r-f-p. i have more or less copied r-f-p from arnesi and unfortunately didn't give it enough thoughts and therefore the current argument order just a heritage.
the (r-f-p plist &rest keys) signature looks much better and performance can be have through inlining the calls, so i suggest to simply changing r-f-p to that signature, and recording the change with a big fat warning.
Um. I think there is some confusion here. What we have is function REMOVE-FROM-PLIST plist &rest key What I think we should have is function REMOVE-FROM-PLIST keys plist &key test key function SANS plist &rest keys I suspect they are both good idioms for diffent cases -- what bothers me about R-F-P as it stands now is that (remove :foo plist :key #'car) has a reversed argument order in comparison to (remove-from-plist plist :foo) I agree that for most uses the &rest list is almost certain to be better, though. And I don't think this is a huge showstopper issue -- just a minor niggle. Another yet-different possibility would be to call it PRUNE-PLIST and keep the current order. Balance between clear name, naming conventions, and usability? Perhaps we can only get two out of three... Cheers, -- Nikodemus
"Nikodemus Siivola" <nikodemus@random-state.net> writes:
What we have is
function REMOVE-FROM-PLIST plist &rest key
What I think we should have is
function REMOVE-FROM-PLIST keys plist &key test key
function SANS plist &rest keys
FWIW, I like this except that I think R-F-P shouldn't take a list of keys but only one key just like REMOVE does. You can always get at the multiple keys behaviour by passing an appropriate :TEST predicate: (remove-from-plist '(:foo :bar) *plist* :test (flip #'member)) -T.
participants (3)
-
Attila Lendvai
-
Nikodemus Siivola
-
Tobias C. Rittweiler