When I try to re-define a package in SBCL in such a way that causes name conflicts, I get a NAME-CONFLICT
error with the restarts
0: [KEEP-OLD] Keep symbols already accessible FOO (shadowing others).
1: [TAKE-NEW] Make newly exposed symbols accessible in FOO, uninterning old ones.
2: [RESOLVE-CONFLICT] Resolve conflict.
3: [RETRY] Retry SLIME REPL evaluation request.
4: [*ABORT] Return to SLIME's top level.
5: [ABORT] Abort thread (#<THREAD "new-repl-thread" RUNNING {10060E47B3}>)
I'd like to write something that would automatically invoke the TAKE-NEW
restart, so that I could do something like
(force (defpackage :foo (:use :cl :bar :baz :mumble)))
The result of this should be the same as calling defpackage
, followed by manually invoking the TAKE-NEW
restart. The problem is,
CL-USER> (handler-case
(defpackage :foo (:use :cl :bar :baz :mumble))
(error (e) (compute-restarts e)))
(#<RESTART SWANK::RETRY {1006DC40F3}> #<RESTART ABORT {10068007E3}>
#<RESTART ABORT {10060C7F93}>)
CL-USER>
I don't seem to have access to that particular restart. As confirmed when I try to invoke it:
CL-USER> (handler-case
(defpackage :foo (:use :cl :bar :baz :mumble))
(name-conflict (e) (invoke-restart 'take-new)))
No restart TAKE-NEW is active.
[Condition of type SB-INT:SIMPLE-CONTROL-ERROR]
Restarts:
0: [RETRY] Retry SLIME REPL evaluation request.
1: [*ABORT] Return to SLIME's top level.
2: [ABORT] Abort thread (#<THREAD "new-repl-thread" RUNNING {10060E47B3}>)
Any ideas?