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

Re: silly (?) question about mixed definitions and packages



> Date: Fri, 3 Nov 89 14:42 PST
> From: Montgomery Kosma <kosma@ALAN.LAAC-AI.Dialnet.Symbolics.COM>
> Subject: silly (?) question about mixed definitions and packages 
> 
> When compiling and loading the following file (a set of stubs,
> essentially, to get some other stuff to compile without actually having
> another whole system available), I am getting the following error:
> 
> Compiling TRI:MOM;BIG-MOM;DATAVAULT-SIMULATOR-HACK.LISP.NEWEST
> Loading TRI:MOM;BIG-MOM;DATAVAULT-SIMULATOR-HACK.BIN.NEWEST
> Warning:  Function CLOSE, being redefined by file TRI:MOM;BIG-MOM;DATAVAULT-SIMULATOR-HACK,
> was previously defined by file SYS:CLCP;IOFNS. OK? (Y, P, or N) Proceed.
> 
> 
> and here's the file:
> 
> ;;; -*- Syntax: Common-Lisp; Package: MATRIX; Base: 10; Mode: LISP; Default-character-style: (:FIX :EXTRA-CONDENSED :NORMAL) -*-
> 
> 
> (defun matrix::dv-open (&rest ignore))
> (defun matrix::matrix-read (&rest ignore))
> (defun matrix::matrix-write (&rest ignore))
> 
> (export '(matrix::dv-open matrix::matrix-read matrix::matrix-write) 'matrix)
> 
> 
> 
> (in-package 'cmfs)
> 
> (defun cmfs::close (&rest ignore))
> (defun cmfs::mkdir (&rest ignore))
> (defun cmfs::unlink (&rest ignore))
> (defun cmfs::close-all-files (&rest ignore))
> 
> (export '(cmfs::close cmfs::mkdir cmfs::unlink cmfs::close-all-files) 'CMFS)
> 
> 
> thanks!
> 
> monty kosma
> lockheed research
> kosma@alan.kahuna.decnet.lockheed.com


CLOSE is a common-lisp function.  Your make-package on CMFS uses CL
(this is almost always the case).  Thus, you are inheriting the CLOSE
symbol from the CL package. Try (symbol-package 'cmfs::close)) to see
what I mean.

To counteract this behavior, shadow the CLOSE symbol from CMFS.  Then
CMFS::CLOSE will be a different symbol, and you can define it without
any redefinition problems.

i.e.

(make-package :cmfs :use '(:cl) ...)

(shadow '(cl:close) :cmfs)


dan haug
haug@austin.lockheed.com