From: Val Kulyukin

Subject: Re: Packages

Date: 1996-7-2 10:00


Hi Tom,

This is a response to your package question. Try the code below.
I saved it in temp.lisp and gave you a brief interaction
with ACL that shows how I compiled the file and used the exported 
symbols in the USER package.

;;; ---------------------

(eval-when (compile eval load)
  
  (unless (find-package :my-package)
    (make-package :my-package :use '(:common-lisp)))
  
  )

(in-package :my-package :use '(:common-lisp))

(export '(*my-global* package-function))

(defconstant *my-global* 42)

(defun package-function ()
  (format t "~%Here we go!"))

;;; ----------------------
;;; end-of file


USER(21): (compile-file "~kulyukin/PROGRAMS/COMMONLISP/GARNET/FAQMINDER/temp")
;;; Compiling file /homes/kulyukin/PROGRAMS/COMMONLISP/GARNET/FAQMINDER/temp.lisp
; Compiling PACKAGE-FUNCTION
;  Note: tail merging call to FORMAT
;;; Writing fasl file /homes/kulyukin/PROGRAMS/COMMONLISP/GARNET/FAQMINDER/temp.fasl
;;; Fasl write complete
#p"/homes/kulyukin/PROGRAMS/COMMONLISP/GARNET/FAQMINDER/temp.fasl"
T
T
USER(22): :ld temp
; Fast loading /homes/kulyukin/PROGRAMS/COMMONLISP/GARNET/FAQMINDER/temp.fasl
USER(23): my-package:*my-global*
42
USER(24): (my-package:package-function)
Here we go!
NIL

;;; ----------------------

You can also switch packages directly while in the USER package so that
the symbols *MY-GLOBAL* and PACKAGE-FUNCTION are available without
the MY-PACKAGE: prefix.

USER(25): (in-package :my-package)
#<The MY-PACKAGE package>
MY-PACKAGE(26): *my-global*
42

MY-PACKAGE(27): (package-function)

Here we go!
NIL
MY-PACKAGE(28): 

Hope this helps.

Peace,
VK