Re: package "CLOS" not found



Dmitry Gorbatovsky wrote:
I am trying to compile (sbcl,debian)
this code (from "screamer+.lisp" ):

(defun slot-names-of (obj)
(mapcar #'(lambda(x) (slot-value x 'CLOS::NAME))
(clos::class-slots (class-of obj))))

and get an error :

package "CLOS" not found.

The code uses features of the CLOS MOP here. Since the CLOS MOP is not part of ANSI Common Lisp, the symbols that name CLOS MOP functionality cannot be part of the common-lisp package (ANSI Common Lisp forbids such extensions of the common-lisp package). Therefore, implementations have to be put these symbols in another package. Unfortunately, the CLOS MOP doesn't specify a package name for its symbols, so every implementation has its own idea where to put the package. Typical names are "CLOS", "MOP", "CLOS-MOP" or some more implementation-specific name.

A good way to find the right package is to do an (apropos "CLASS-SLOTS") (or an apropos on some other CLOS MOP identifier), and/or check out the documentation of the respective implementation. Another way is to use the Closer to MOP library which, apart from fixing some compatibility issues, provides a common package name for all implementations. See http://common-lisp/project/closer


Pascal

--
3rd European Lisp Workshop
July 3 - Nantes, France - co-located with ECOOP 2006
http://lisp-ecoop06.bknr.net/
.



Relevant Pages

  • Re: package "CLOS" not found
    ... extensions of the common-lisp package). ... Unfortunately, the CLOS MOP ... provides a common package name for all implementations. ...
    (comp.lang.lisp)
  • Re: CLOS question -- getting info about objects slots
    ... (class-slots (class-of object)) ... gives you the slots defined for an object as slot definition metaobjects. ... The CLOS MOP is not part of ANSI Common Lisp, so you need to use an implementation-dependent package that contains the CLOS MOP definitions. ...
    (comp.lang.lisp)
  • Re: private data hiding via closures?
    ... (class-slots (class-of object))) ... The CLOS MOP is not part of ANSI Common Lisp. ... So you have to see in which packages those functions are interned. ... Typical names for the CLOS MOP package are CLOS, MOP, SB-MOP, CLOS-MOP, etc. ...
    (comp.lang.lisp)
  • Re: obtaining a packages functions
    ... internet or in Paul Graham's Ansi Common Lisp. ... only those defined in the package itself. ... One does not call a defun, ... "Return a list of functions defined in the package PKG." ...
    (comp.lang.lisp)
  • Re: export setf expansion
    ... > So, if I define a setf function in a package, how can I export it? ... and in particular, not ANSI Common Lisp. ...
    (comp.lang.lisp)