From: Robert STRANDH
Subject: defconstant redefinitions
Date: 
Message-ID: <6wn1kr14nq.fsf@serveur3-1.labri.u-bordeaux.fr>
Hello,

I am having a problem with redefintions of constants as defined by
defconstant.  I assume I am not the first one to have this problem, so
I am looking for an idiomatic solution. 

Here is the problem:

 I have a source file containing defconstant forms the values of which
 are instances of classes created (indirectly) by make-instance. 

 a. When recompiling the source file after having loaded it, I get
 error messages because the compiler must redefine the constants, and
 they already have values that are different from the new ones to be
 assigned.

 b. When reloading the file, I also get error messages since loading the
 file re-executes the defconstant forms. 

For part `a', I could use eval-when to suppress compilation, I
suppose.  For part `b' I was thinking of maintaining a hash table so
that the new value will be `eq' to the old provided that it is
operationally equivalent. 

Any advice?

P.S. I am using CMU CL, in case that is important. 

-- 
Robert Strandh

---------------------------------------------------------------------
Greenspun's Tenth Rule of Programming: any sufficiently complicated C
or Fortran program contains an ad hoc informally-specified bug-ridden
slow implementation of half of Common Lisp.
---------------------------------------------------------------------

From: Frode Vatvedt Fjeld
Subject: Re: defconstant redefinitions
Date: 
Message-ID: <2hk8fv84kd.fsf@dslab7.cs.uit.no>
Robert STRANDH <·······@labri.u-bordeaux.fr> writes:

> I am having a problem with redefintions of constants as defined by
> defconstant.  I assume I am not the first one to have this problem,
> so I am looking for an idiomatic solution.

How about using defvar or defparameter instead?

-- 
Frode Vatvedt Fjeld
From: Coby Beck
Subject: Re: defconstant redefinitions
Date: 
Message-ID: <960829492517@NewsSIEVE.cs.bonn.edu>
Frode Vatvedt Fjeld <······@acm.org> wrote in message
···················@dslab7.cs.uit.no...
| Robert STRANDH <·······@labri.u-bordeaux.fr> writes:
|
| > I am having a problem with redefintions of constants as defined by
| > defconstant.  I assume I am not the first one to have this problem,
| > so I am looking for an idiomatic solution.
|
| How about using defvar or defparameter instead?
|
| --

Use defparameter,  defvar won't clobber any previously bound value.

Coby