Redefine generic function with different lambda list
Asked Answered
P

3

8

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.

Pros answered 29/7, 2013 at 10:8 Comment(0)
T
10

See fmakunbound.

(fmakunbound 'some-generic)
Throb answered 29/7, 2013 at 11:10 Comment(1)
oh, yes, that would be a lot easier.Pros
S
9

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

Slug answered 29/7, 2013 at 15:26 Comment(0)
H
0

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.

Harlow answered 29/7, 2013 at 10:27 Comment(1)
Heh, now I've come to conclusion, I actually want it back w/o the keywords... this appears to be harder :) Just to make sure: my only options at the restart, when I define incompatible methods are to either quit or abort... it doesn't offer to replace anything.Pros

© 2022 - 2024 — McMap. All rights reserved.