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

Re: package and shadow prob



> 
> 
> I'm trying to modify an OPS5 package to run under 2.0, but am confused
> as to the proper way to use the package and shadow functions.  Currently,
> the file is set up as:
> 
>  ; -*- Mode: Lisp; Package: Ops -*-
>  (cl:defpackage ops)
>  (cl:in-package :ops)
> 
>  ...
> 
>  (shadow '(remove write) (find-package 'ops))
> 
>  (defmacro remove (&body z)
>   `(ops-remove ',z))
> 
>  ...
> 
> It compiles ok with a few unrelated warnings, but when entering 
> 
>  (require :ops)    from the listener, I get redefine warnings.
> Can someone enlighten me as to the correct way to do this?  Thanks.
> 
> swood@z.eecs.umich.edu
> 
> 

See the second (changed) and third (new) paragraphs of Section 11.7
on pp. 261-262: the compiler's treatment of toplevel calls to package-
manipulating functions has changed between CLtL1 and CLtL2.

The simplest workaround is to surround toplevel calls to EXPORT, SHADOW, etc.
with (EVAL-WHEN (EVAL COMPILE LOAD) ...) forms.  Since you're already using
DEFPACKAGE, you might prefer to instead say something like:

(cl:defpackage ops (:use "COMMON-LISP")
                   (:shadow "REMOVE" "WRITE"))


(Explicitly USEing the COMMON-LISP package - as opposed to implicitly using
both it and the CCL package - might also help to avoid unintentional conflicts
between external symbols in the CCL package and symbols in the OPS package.)