Re: Is DEFCONSTANT broken?
- From: Duane Rettig <duane@xxxxxxxxx>
- Date: Tue, 23 Jun 2009 15:20:34 -0700 (PDT)
On Jun 23, 2:40 pm, Scott Burson <FSet....@xxxxxxxxx> wrote:
On Jun 22, 6:46 pm, Ron Garret <rNOSPA...@xxxxxxxxxxx> wrote:
In article <20090704083602....@xxxxxxxxx>,
Kaz Kylheku <kkylh...@xxxxxxxxx> wrote:
(eval-when (:load-toplevel)
(define-symbol-macro c7 (c7)))
See: two different definitions for diferent situations, creating the
illusion of one consistent constant.
That works insofar as (eq c7 (c7)) returns T. However, it's not really
what I want. The main reason I want to use DEFCONSTANT is to prevent c7
from being reassigned or rebound. If C7 is a symbol macro I don't get
that guarantee. If I were willing to rely on the user not to assign or
bind c7 I could just use DEFVAR and be done with it.
Yeah, oh well.
To address your larger point, yes, I have long thought DEFCONSTANT is
not as useful as its inventor(s) probably hoped.
That's because you're thinking of defconstant as providing some sort
of "protection", which it does not. In fact, CL as a whole is an open
language which relies on the goodwill of the programmer to ensure that
things don't get mashed. If you want a language that provides you
with guarantees of bondage, CL is not the language for you, and due to
those of us who enjoy the freedom (I'm sure you're also one of them)
it's not likely to change in that direction.
Duane
.
- Follow-Ups:
- Re: Is DEFCONSTANT broken?
- From: Scott Burson
- Re: Is DEFCONSTANT broken?
- References:
- Is DEFCONSTANT broken?
- From: Ron Garret
- Re: Is DEFCONSTANT broken?
- From: Pascal J. Bourguignon
- Re: Is DEFCONSTANT broken?
- From: Ron Garret
- Re: Is DEFCONSTANT broken?
- From: Pascal J. Bourguignon
- Re: Is DEFCONSTANT broken?
- From: Ron Garret
- Re: Is DEFCONSTANT broken?
- From: Scott Burson
- Re: Is DEFCONSTANT broken?
- From: Ron Garret
- Re: Is DEFCONSTANT broken?
- From: Kaz Kylheku
- Re: Is DEFCONSTANT broken?
- From: Kaz Kylheku
- Re: Is DEFCONSTANT broken?
- From: Ron Garret
- Re: Is DEFCONSTANT broken?
- From: Scott Burson
- Is DEFCONSTANT broken?
- Prev by Date: Re: Is DEFCONSTANT broken?
- Next by Date: LISP vs HASKELL vs PROLOG
- Previous by thread: Re: Is DEFCONSTANT broken?
- Next by thread: Re: Is DEFCONSTANT broken?
- Index(es):
Relevant Pages
|