From: James M. L. <llm...@gm...> - 2013-03-30 20:34:02
|
(defpackage :foo (:use :cl) (:export :hello)) (in-package :foo) (defpackage :bar (:use :cl)) (in-package :bar) ;; oops, I meant foo:hello 'hello (defpackage :bar (:use :cl :foo)) The new restarts are 0: [KEEP-OLD] Keep symbols already accessible BAR (shadowing others). 1: [TAKE-NEW] Make newly exposed symbols accessible in BAR, uninterning old ones. The most common mistake -- at least for me -- is using a symbol that was expected to be present but wasn't. Since TAKE-NEW corrects that mistake, I think it should appear first. (SLIME completion prevents this problem when typing new code, but moving existing code is another matter.) Replacing the last defpackage with (import 'foo:hello) results in 0: [SHADOWING-IMPORT-IT] Shadowing-import FOO:HELLO, uninterning BAR::HELLO. 1: [DONT-IMPORT-IT] Don't import FOO:HELLO, keeping BAR::HELLO. This has the "right" order, but regardless of the order it should at least be consistent with the DEFPACKAGE restarts. I would also vote for using the same or similar restart names in IMPORT and DEFPACKAGE. TAKE-NEW and KEEP-OLD seem nicer than SHADOWING-IMPORT-IT and DONT-IMPORT-IT respectively. The descriptions would obviously remain different, according to whether IMPORT or DEFPACKAGE was called. |