Re: Is DEFCONSTANT broken?
- From: Scott Burson <FSet.SLB@xxxxxxxxx>
- Date: Tue, 23 Jun 2009 17:09:24 -0700 (PDT)
On Jun 23, 3:20 pm, Duane Rettig <du...@xxxxxxxxx> wrote:
On Jun 23, 2:40 pm, Scott Burson <FSet....@xxxxxxxxx> wrote:
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.
There's that, but there's also the issue raised on the SBCL page
someone in this thread linked to, which is that it arguably would be
better if it didn't assign a new value on repeated evaluation (i.e. it
should be more like DEFVAR).
Back to your point, no, I'm not into bondage either, but I do
appreciate helpfulness. For example, I could imagine an
implementation noting cases where the compiler has integrated a
declared constant into a compiled routine, in such a way that it could
e.g. warn you, when loading a fasl file, if the current value of the
declared constant differs from the one the function was compiled
with. I don't know if the spec should have mandated such helpfulness,
but I think DEFCONSTANT would be more useful if at least the high-end
implementations did stuff like that.
And thirdly, I'm inclined to agree with Ron that the sentence of the
spec he quoted is unfortunate: "An implementation may choose to
evaluate the value-form at compile time, load time, OR BOTH [emphasis
added]." I think it should have to be evaluated at compile time,
period, and Ron has given a good argument as to why.
All this is off the cuff, though, and I could be persuaded otherwise.
I just know that over the years I have made little use of DEFCONSTANT.
-- Scott
.
- Follow-Ups:
- Re: Is DEFCONSTANT broken?
- From: Duane Rettig
- 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
- Re: Is DEFCONSTANT broken?
- From: Duane Rettig
- Is DEFCONSTANT broken?
- Prev by Date: Re: Is DEFCONSTANT broken?
- Next by Date: Re: Is DEFCONSTANT broken?
- Previous by thread: Re: Is DEFCONSTANT broken?
- Next by thread: Re: Is DEFCONSTANT broken?
- Index(es):
Relevant Pages
|