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

a (last ?) package question



You are evaluating the DEFPACKAGE in the USER package, before Lisp has
any idea what the form is about, so all new the unqualified symbols
(including those in the EXPORT list) are interned in the default
package, USER.

(defpackage zelda
  (:prefix-name "ZELDA")
  (:use symbolics-common-lisp)
  (:export u d tt db l s h sd m st restart w e eplan editdb findme))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Unqualified symbols--^

One easy solution is to qualify those symbols the first time they are
read in.  You'll have to do it after the DEFPACKAGE has created ZELDA.

(defpackage zelda
  (:prefix-name "ZELDA")
  (:use symbolics-common-lisp))

(export '(zelda::u zelda::d zelda::tt zelda::db zelda::l zelda::s zelda::h
	  zelda::sd zelda::m zelda::st zelda::restart zelda::w zelda::e
	  zelda::eplan zelda::editdb zelda::findme)
	'zelda) 

Why should this be necessary?  Because you want ZELDA to inherit from
USER, and you also want to define the ZELDA package in the USER package. 


Other ideas (pick the one you find to be graceful):

o Put the symbols in the EXPORT list in a package other than USER or ZELDA:

(defpackage zelda
    (:prefix-name "ZELDA")
      (:use symbolics-common-lisp)
        (:export :u :d :tt :db :l :s :h :sd :m :st
		 :restart :w :e :eplan :editdb :findme))

o Do the exporting in a file which is already read into the ZELDA
package, so that adding a symbol will not require adding "ZELDA::".

;;; -*- Mode: LISP; Base: 10; Syntax: Common-lisp; Package: Zelda -*-

(export '(u d tt db l s h sd m st restart w e eplan editdb findme) 'zelda)

...

Have fun with it.           ______
                            HUNTER