packagecommon-lispname-conflict

How to import external package symbols with excluding some


In a new package I want to :use (inherit from) package packa and packb.

packa and packb have an intersection of exported symbols.

How is it possible to inherit all from packa but only those of packb that are not intersecting with packa?

UPDATE:

I've tried :use packa and selectively :import-from symbols from packb that I need and don't collide with packa. However that's quite combersome.

I've experimented a bit with do-external-symbols and intern/import, but that doesn't seem to work, or at least I don't know how it could work.


Solution

  • Shadowing is the way to avoid conflicts in this case.

    If you want to use symbols from packa without a prefix, use :shadowing-import-from #:packa #:sym1 #:sym2 ... in your package definition. Or, use packb if you prefer those symbols without a prefix.

    If you prefer to use prefixes for all of the conflicting symbols from both packages, use :shadow #:sym1 #:sym2 ... instead.