Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Constants and DEFCONSTANT
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Kent M Pitman  
View profile  
 More options Mar 30 1999, 3:00 am
Newsgroups: comp.lang.lisp
From: Kent M Pitman <pit...@world.std.com>
Date: 1999/03/30
Subject: Re: Constants and DEFCONSTANT
pe...@harlequin.co.uk (Pekka P. Pirinen) writes:

> Kent M Pitman <pit...@world.std.com> writes:
> > If you inline a constant (another thing defconstant is for) and you
> > inline operations on the constant (another thing defconstant is
> > for), then you get in a place where the identity of the subparts
> > isn't tagged and the bookkeeping is hard.

> Then don't do that.  Surely if DEFCONSTANT is supposed to preserve
> identity (and I must say it was a schock to me to hear that some
> implementors thought it needn't), then the compiler is in error if
> it constant-folds (I guess that's what you mean by "inlines an
> operation") in a way that fails to preserve that identity.

No, the problem is you don't know what the compiler will inline, so you
can't know what to "not do".

Further, a useful property of programs is that if you attach a name
to something, it doesn't change its semantics.  You're basically saying
in this case that it does.  I think that's wrong.

I'm not concerned with the use of Lisp as an implementation language for
getting something done.  Lisp is not about that.  If I wanted that,
I'd use C.  Lisp is about allowing me to express things in terms of my
high-level intent by saying things that I want clearly, not obliquely.
One of its strengths is that it allows you to freely use anonymous things.
If shifting between named and unnamed things starts to have mysticism
associated with it, that kills that property of the language.

> That's not hard: The compiler _doesn't_ constant-fold over references to
> constant variables whose values are data structures.

This may be a truth about some compiler (or many) but is not a truth
about Lisp.

> I know LispWorks
> works like that.  Steven M. Haflich indicated (in the "`fast' global
> variables" thread) that ACL "only dereferences constants like numbers
> and symbols".  Is there any implementation except MCL who don't get it
> right?

Defining that 60 compilers do it this way would be meaningless unless
you can convince me that there is a reason to do it this way.  I don't
see the conceptual basis for saying it has to be done this way.

> In any case, implementing constant identity is exactly the kind of
> thing that should be left to compiler writers, the language should
> just offer a way to declare a constant.  I must say that if it was the
> intention of the committee to let DEFCONSTANT break a basic language
> feature like that, the standard should have included a clear warning.

I'm missing what language feature you're saying DEFCONSTANT breaks.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.