Subject: Re: packages
From: Erik Naggum <erik@naggum.net>
Date: Thu, 27 Sep 2001 15:06:59 GMT
Newsgroups: comp.lang.lisp
Message-ID: <3210592018171463@naggum.net>

* Vojin Jovanovic
> But, what if it means exactly that, what do I do then?  I want to have my
> own definition of CLOS. When I load a file I want to shadow the current
> CLOS and use my own provided by the file.  Is it possible to do that
> somehow automatically?

  There is usually a top-level or system-global variable that you can set
  in an initialization file, but the way these things usually work is that
  you really do set the package you want to work within.  E.g., a system I
  built which uses an initialization file to set things up because so much
  depends on weird interactions, goes like this:

(setf tpl::*saved-package*
  (setf *package*
    (setf (system:global-symbol-value '*package*)
      (find-package :tdn))))

(setf (cdr (assoc '*package* *cl-default-special-bindings*))
  '(find-package :tdn))

(when (lep:lep-is-running)
  (lep::eval-in-emacs "(setq-default fi:package \"tdn\")"))

> In CLISP when it is started the *package* is COMMON-LISP-USER.  This
> package uses packages "COMMON-LISP" and "EXIT".  Now if you do
> (in-package "COMMON-LISP") and (unuse-package "CLOS"), the
> (package-use-list "COMMON-LISP") gives nil, but defmacro defclass is
> still available for example? Again, what is the purpose of unuse-package
> function if the definitions from "CLOS" are still available?

  Are you sure you know in which package the symbol defclass is defined?
  You just look so hopelessly confused it is hard to figure out if giving
  you any answers will help you, but the clue to your problems is probably
  to define your own package and import only the symbols you need from the
  common-lisp package and _not_ to import the symbols you would like to
  redefine.  I think you need to re-examine your problem before you start
  to complain about the solutions.

///
-- 
  Why did that stupid George W. Bush turn to Christian fundamentalism to
  fight Islamic fundamentalism?  Why use terms like "crusade", which only
  invokes fear of a repetition of that disgraceful period of Christianity
  with its _sustained_ terrorist attacks on Islam?  He is _such_ an idiot.