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

The packages strike again



    Can someone suggest what I do wrong?
    
    1) I startup MCL+CLIM
    2) I evaluate the following buffer
    and I immediately get the error below...
    
    The buffer contains:
    ---------------------------------------------------------------------
    ;;; -*- Package: USER; Syntax: Common-Lisp; Base: 10 -*-
    
    (defpackage :manexQC-REPORT 
      (:use :clim-user :user))
    
    
    (in-package :manexQC-REPORT)
    
    (defun test () nil)
    (defvar *current-y-position* 40)
    
    ---------------------------------------------------------------------
    
    
    The error I get is:
    
    ---------------------------------------------------------------------
    Welcome to Macintosh Common Lisp Version 2.0p1!
    ? 
    > Error: Unbound variable: TEST
    > While executing: COMMON-LISP:SYMBOL-VALUE
    > Type Command-/ to continue, Command-. to abort.
    > If continued: Retry getting the value of TEST.
    See the Restarts
    1 > 
    
    ---------------------------------------------------------------------
    
    
    I though that creating a package that uses :clim-user and :user would allow
    me to use all external symbols from these packages, ie all CL, CLIM,
    mcl-specific extensions (in user) and clim-specific extensions (clim-user).
    
    It seems that defun is not recognized...
    
    If I comment out that line, reboot lisp and re-evaluate the buffer, I get
    (for the defvar):
    
    ---------------------------------------------------------------------
    Welcome to Macintosh Common Lisp Version 2.0p1!
    ? 
    > Error: Unbound variable: *CURRENT-Y-POSITION*
    > While executing: COMMON-LISP:SYMBOL-VALUE
    > Type Command-/ to continue, Command-. to abort.
    > If continued: Retry getting the value of *CURRENT-Y-POSITION*.
    See the Restarts
    1 > 
    
    Thanks for any help
    
    Vincent
    
    --
    Keunen Vincent
    R&D, Software Engineer
    keunen@montefiore.ulg.ac.be
    tel: +32 41 407282
    fax: +32 41 481170

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).

Personally, I would NOT use :ccl and :clim packages simultaneos,
to give you as a programmer and the reader a clear direction.


- Stefan Bernemann   (berni@iml.fhg.de)