I've made a mistake and forgot to specify keyword arguments in defgeneric the first time I've compiled it. Now I really don't want to restart SLIME only to redefine this one defgeneric to include more arguments. Is there a way to "undefine" it somehow?

Oh, sorry, never mind, after removing all methods defined for that generic, SBCL redefined it, so it's all good now:

(remove-method #'some-generic 
  (find-method #'some-generic '() (list of method types)))

For posterity.

有帮助吗?

解决方案

See fmakunbound.

(fmakunbound 'some-generic)

其他提示

SLIME has the command Ctrl-c Ctrl-u to undefine a function. Set the cursor on the function symbol and then type the sequence.

Another possibility would be to compile one or more methods with the additional arguments and then, after your Common Lisp implementation "complains" about the unknown parameters, select the restart which updates the arguments available in the generic function.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top