[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problems with packages



i have the following 3 files.
more c.lsp
(use-package "CLOS")
(load 's)
(load 'p)
 
 more s.lsp
(defpackage "SETS-PACK" (:use "COMMON-LISP" "CLOS")
  (:shadow "SETS" "INTERSECTION")
  (:export "SETS" "INTERSECTION"))
(in-package "SETS-PACK")
(defclass sets ()
 ((tipe :accessor tipe :initarg :tipe)
  (elements :accessor elements)))
(defgeneric intersection (a b &key test test-not key))
(defmethod intersection ((s1 sets) (s2 sets) &rest more)
  (unless (equal (tipe s1) (tipe s2)) (error "bad type"))
  (apply #'lisp:intersection (elements s1) (elements s2) more))
(defmethod intersection ((s1 sequence) (s2 sequence) &rest more)
  (apply #'lisp:intersection s1 s2 more))
 
and more p.lsp
(use-package "SETS-PACK")
(setf a (make-instance 'sets :tipe 't))  

when i execute clips as follows i get the error
clisp -q -i c.lsp
;; Loading file c.lsp ...
;; Loading file /home/dxs/l/s.lsp ...
;; Loading of file /home/dxs/l/s.lsp is finished.
;; Loading file /home/dxs/l/p.lsp ...
** - Continuable Error
1 name conflicts while executing USE-PACKAGE of (#<PACKAGE SETS-PACK>) into package #<PACKAGE USER>.
If you continue (by typing 'continue'): You may choose for every conflict in favour of which symbol to resolve it.
1. Break>continue
which symbol with name "INTERSECTION" should be accessible in #<PACKAGE USER> ?
Please choose:
          1  --  SETS-PACK
          2  --  USER
 
>
i thought that shadowing intersection would eliminate this problem.
does anybody have any ideas on this?
thanks,
dan stanger