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

The lisp developers fight back (was: The packages strike again)



Thanks to all that replied (Ralf Moeller, Gilles Serasset - en francais
dans le texte :) -, rudolf mittelmann, berni@iml.fhg.de).  A few excerpts
from the answers:

--------------------
>Use-package:
>This causes a package to inherit all of the external symbols of some other
>package. These symbols become accessible as INTERNAL symbol of the using
>package. That is they can be refered to without a qualifier while this
>package is current, BUT THEY ARE NOT PASSED ALONG TO ANY OTHER PACKAGE THAT
>USES THIS PACKAGE. [CLtL2, p 253].

--------------------
package inheritance is NOT transitive - so you have to 
use all default packages including common-lisp *explicitly*.

--------------------
The symbols you need are not *exported* from CLIM-USER or CL-USER and, therefore
are not accessible in client packages.

--------------------
Well, the packages user and clim-user dont have any external symbols,
in fact they are rather empty so that the user can go ahead.

These packages :use the appropriate lisp and additional packages:

? (package-use-list :clim-user)
(#<Package "CLIM-LISP"> #<Package "CLIM">)

? (package-use-list :user)
(#<Package "CC"> #<Package "CCL"> #<Package "COMMON-LISP">)
? 


To get what you want, you should do something like:

(defpackage foo
  (:use :clim-lisp :clim :ccl))

However, this will result in some nameconflicts. To clearly
see these, first define a "pure" lisp package by

(defpackage bar
  (:use :common-lisp))

and then go to this package

(in-package :bar)

This has the effect that all clim- and ccl- symbols are
printed with their package prefixes.

If you now evaluate the above package definition, you get
the following:

? (defpackage foo
  (:use :clim-lisp :clim :ccl))
> Error: Using #<Package "CLIM"> in #<Package "FOO"> 
>        would cause name conflicts with symbols inherited by that package: 
>        CLIM-LISP:STREAM-WRITE-STRING  CCL:STREAM-WRITE-STRING
>        CLIM:FIND-MENU-ITEM  CCL:FIND-MENU-ITEM
>        CLIM-UTILS:MAKE-POINT  CCL:MAKE-POINT
>        CLIM:MENU-ITEM-STYLE  CCL:MENU-ITEM-STYLE
>        CLIM:WINDOW-EVENT  CCL:WINDOW-EVENT
>        CLIM:MENU-ITEM  CCL:MENU-ITEM
>        
> While executing: CCL::USE-PACKAGE-1
> Type Command-/ to continue, Command-. to abort.
> If continued: Try again to use #<Package "CLIM"> in #<Package "FOO">
See the Restarts. menu item for further choices.
1 > 

It's up to you how you resolve the name conflicts (preferring
one of the packages).

Vincent

--
Keunen Vincent
R&D, Software Engineer
keunen@montefiore.ulg.ac.be
tel: +32 41 407282
fax: +32 41 481170