Simplify restarts for symbol conflicts
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
New
|
Undecided
|
Unassigned |
Bug Description
(defpackage :foo (:use :cl) (:export :hello))
(defpackage :bar (:use :cl)) ; oops, forgot to :use foo
(in-package :bar)
'hello ; oops, I meant foo:hello
;; Import and choose a restart...
(import 'foo:hello)
;; ...or fix the defpackage and choose a restart.
(defpackage :bar (:use :cl :foo))
The attached patch tweaks some restarts.
Old restarts for the above IMPORT form:
0: [SHADOWING-
1: [DONT-IMPORT-IT] Don't import FOO:HELLO, keeping HELLO.
New restarts for the above IMPORT form:
0: [TAKE-NEW] Shadowing-import FOO:HELLO, uninterning BAR::HELLO.
1: [KEEP-OLD] Don't import FOO:HELLO, keeping BAR::HELLO.
New restarts for the second DEFPACKAGE form:
0: [TAKE-NEW] Make newly exposed symbols accessible in BAR, uninterning old ones.
1: [KEEP-OLD] Keep symbols already accessible in BAR (shadowing others).
The DEFPACKAGE restarts are unchanged except the order is swapped. I
would argue that the more common mistake is referring to a symbol that
was expected to be present but wasn't, as in the above example. Since
TAKE-NEW corrects that, it should go first.
tags: | added: patch |