Subject: [clisp-list] How to keep a package?

From: Pascal Bourguignon <[email-masked]>
Date: Fri Aug 9 21:43:01 2002

I have this "package":

--(test-package.lisp)-------------------------------------------------
(make-package "test-package" :use '("COMMON-LISP" "EXT" "SYSTEM" "POSIX" ))
(in-package "test-package")

(defun my-fun ()
  (format t "I'm test-package::my-fun ~%")
  );;my-fun
----------------------------------------------------------------------

Which I try to use as follow:

[pascal@thalassa tmp]$ clisp -q
;; Loading file /home/pascal/.clisprc.lisp ...
;; Loading of file /home/pascal/.clisprc.lisp is finished.
[1]> (load "test-package.lisp")
;; Loading file test-package.lisp ...
;; Loading of file test-package.lisp is finished.
T
[2]> (test-package::my-fun)

*** - READ from #<CONCATENATED-STREAM #<STRING-INPUT-STREAM> #<SYNONYM-STREAM *TERMINAL-IO*>>: there is no package with name "TEST-PACKAGE"
1. Break [3]> 

(my .clisprc.lisp is empty for now).

If I replace the make-package call by:

   (defpackage "test-package" (:use "COMMON-LISP" "EXT" "SYSTEM" "POSIX" ))

I still get the exact same result.

How one can make and keep a package?

Why clisp does not implement  in-package as defined in Cltl2, that is,
creating the package automatically if it does not already exist?

-- 
__Pascal_Bourguignon__                   http://www.informatimago.com/
----------------------------------------------------------------------

---

From: Kaz Kylheku <[email-masked]>
Date: Sat Aug 10 09:39:03 2002

On Sat, 10 Aug 2002, Pascal Bourguignon wrote:

> Date: Sat, 10 Aug 2002 06:39:23 +0200 (CEST)
> From: Pascal Bourguignon <[email-masked]>
> To: [email-masked]
> Subject: [clisp-list] How to keep a package?
> 
> 
> I have this "package":
> 

Your package is called "test-package", but here you are trying to use
"TEST-PACKAGE". Lisp symbol names are case sensitive. This sensitivity
is rarely visible, because (by default) the names of symbols are
converted to upper case when symbol tokens are read.
An escape mechanism is provided to suppress that:

    (|test-package|::my-fun)

When defining packages, it's probably a better idea to use keywords or
rather than naked strings. SOme people use unterned symbols too.
If you must use strings, remember to type all the names upper case.

    (defpackage "FOO" ... (:use "COMMON-LISP") ...)

    (defpackage :foo ... (:use :common-lisp) ...)

> creating the package automatically if it does not already exist?

Lisp is defined by the ANSI standard, not by Cltl2.  The in-package
macro is required to signal an error of type package-error if the
package does not exist. See the HyperSpec.