0

Let's say we have the following prerequisites:

(quickproject:make-project "lib1")
(quickproject:make-project "lib2")

;;;; Modify lib1/package.lisp like that:                                                                                                                                                            
(defpackage #:lib1
  (:use #:cl)
  (:export #:symbol1))

;;;; Modify lib2/package.lisp like that:                                                                                                                                                            
(defpackage #:lib1
  (:use #:cl)
  (:export #:symbol2))

(quickproject:make-project "project1")


;;;; Edit the project1's asdf:defsystem so that it has the following dependencies:
:depends-on (:lib1 :lib2)

Load project1 and inspect the lib1 package and you will note that you have both symbol1 and symbol2 there.

Implications:

  • Different dependencies can pollute the packages of other dependencies
  • Worse - one dependency can redefine symbol definitions of another dependency and break the system.

I can probably solve my current problem by adopting a package naming convention like the one used in Java (with long delimited names). However, this appears to be a problem that is supposed to be solved as a community. We need a general purpose solution that will apply to all CL libraries. What would that be?

vkamenen
  • 51
  • 7
  • 1
    Isn’t the solution to just avoid using package names that are likely to clash (e.g. `macros`), such that the only way to have clashing package names would be to have two libraries that do the same thing. I think the difficulty would be e.g. two libraries as dependencies, each wanting a different logging library, each of which uses the package name `#:log`. – Dan Robertson Feb 15 '19 at 07:55
  • Well, even if the two libraries do different things they can define packages with the same name. – vkamenen Feb 15 '19 at 08:17
  • 1
    When I do that with SBCL, I have warnings about package variance (see sb-ext:*on-package-variance*). – coredump Feb 15 '19 at 09:37

0 Answers0