How to Easily Specify Export Symbol



Hi,

I was developing my own little package shadowing some of LISP function
to be generic (<, >, equal, etc.).

So in my package.lisp, I have

(defpackage :cl-oo
(:use :common-lisp)
(:shadow :< :> :equal ...) ; Only list the symbol that I shadow
(:export :< :> :equal ...)) ; Only list the symbol that I shadow

Now when I want to use this package, I thought I would do

(defpackage :my-app
(:use :common-lisp :cl-oo))

Surely this won't work, A condition will be signaled because symbol in
:cl-oo and common-lisp conflict.

I could have fixed this by declare the shadowing symbol.

(defpackage :my-app
(:use :common-lisp :cl-oo)
(:shadowing-import-from :cl-oo :< :> :equal ...))


But I don't want to repeat myself again like that.
I want to be able to specify once somewhere, that, if these two
packages are use together, symbols from :cl-oo package will shadow
those in :common-lisp packages.

Only way I see is

(defpackage :cl-oo-wrapper
(:import-from :common-lisp :defun :defmacro ...) ; All Symbol not
shadow by :cl-oo
(import-from :cl-oo :< :> :equal ...) ;All symbol exported by :cl-oo,
and much more.
(:export :defun :defmacro :< :> ...)) ;Merge of Symbols above

Then I can use this package

(defpackage :my-app
(:use :cl-oo-wrapper))

But is the the best way to do it?
Listing out all symbols seems not very smart to me.

.



Relevant Pages

  • Re: SHADOW, EXPORT And DEFMACRO
    ... I quite strongly recommend not doing 'demand shadowing'. ... When you make a package so that it dynamically changes at the drop of a hat, ... It's just typically a practical requirement of people's sanity. ...
    (comp.lang.lisp)
  • Re: getting fancy with packages
    ... > My screamer function file now looks like: ... you needed to use the macro DEFINE-SCREAMER-PACKAGE. ... This macro creates a package with the standard symbols DEFUN, ... the same shadowing imports that DEF-SCREAMER-PACK makes, ...
    (comp.lang.lisp)
  • Re: Slime and Reloading files
    ... Exporting and shadowing are completely different. ... Shadowing controls where the reader ... your package use COMMON-LISP. ...
    (comp.lang.lisp)
  • Re: packages
    ... > defined in the cl package (all other symbols I use are defined in the ... > goms package). ... packages are used exactly to circumvent this kind of ... Packages are used, it's called shadowing. ...
    (comp.lang.lisp)
  • Re: How to Easily Specify Export Symbol
    ... > Now when I want to use this package, ... No, you're not working with COMMON-LISP anymore, you're working with CL-OO: ... Touch my tail, I shred your hand. ... Prev by Date: ...
    (comp.lang.lisp)