[cl-irc-devel] [PATCH] make remove-channel api consistent
Erik Huelsmann
e.huelsmann at gmx.net
Sun Mar 14 18:35:55 UTC 2004
Hi!
On my quest for defmethods that needed defgenerics, I found an inconsistency
in the API. I have no idea if this project has any provisions or policies
about breaking APIs, so I'm mailing the list.
The add-* apis use the object to add to as the first parameter and the
object to be added as the second. So does the remove-channel api, except for one
point: (remove-channel <channel-object> <user-object>). Resolving this item is
not critical, but nice to have. Since parts of code of external parties
might depend on the api, I decided to add a warn statement, but leave the api in
place. I added a new defmethod which is the same, except that it has its
parameters reversed.
I'll rewrite the library (and possibly the examples) to use the new API
ofcourse - given that there will be no objections.
bye,
Erik.
PS: I don't think I can remember the changes I am committing some months
from now, so I'll institute the ChangeLog as previously discussed.
The patch:
Index: protocol.lisp
===================================================================
RCS file: /project/cl-irc/cvsroot/cl-irc/protocol.lisp,v
diff -u -r1.2 protocol.lisp
--- protocol.lisp 8 Jan 2004 23:11:47 -0000 1.2
+++ protocol.lisp 14 Mar 2004 18:34:35 -0000
@@ -437,6 +437,14 @@
(defmethod remove-channel ((channel channel) (user user))
"Remove `channel' from `user'."
+ (warn
+ (concat 'string
+ "use of depricated API (remove-channel channel user): "
+ "(remove-channel user channel) is now preferred"))
+ (remove-channel user channel))
+
+(defmethod remove-channel ((user user) (channel channel))
+ "Remove `channel' from `user'."
(setf (channels user) (remove channel (channels user))))
(defmethod remove-user ((connection connection) (user user))
--
+++ NEU bei GMX und erstmalig in Deutschland: TÜV-geprüfter Virenschutz +++
100% Virenerkennung nach Wildlist. Infos: http://www.gmx.net/virenschutz
More information about the cl-irc-devel
mailing list