[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: LOAD-TIME-EVAL
- To: Kent M Pitman <KMP@STONY-BROOK.SCRC.Symbolics.COM>
- Subject: Re: LOAD-TIME-EVAL
- From: David N Gray <Gray@DSG.csc.ti.com>
- Date: Fri, 9 Sep 88 17:11:50 CDT
- Cc: CL-Compiler@SAIL.Stanford.EDU
- In-reply-to: Msg of Fri, 9 Sep 88 12:04 EDT from Kent M Pitman <KMP@STONY-BROOK.SCRC.Symbolics.COM>
- Sender: GRAY@Kelvin.csc.ti.com
> The full text of the system I'm alluding to in the second example does do
> side-effects. They are of two kinds:
> - ADJUST-ARRAY is done on one of the arrays
...
> - If the slot mappings change, it fills the table with new values.
Kent,
OK, I think I see now where you're coming from, but I don't think we really
have a conflict here. Going back to the original proposal, it says:
The READ-ONLY-P argument designates whether the result can be considered
read-only constant. If NIL, the result must be considered ordinary,
modifiable data. If T, the result is a read-only quantity which may, as
appropriate, be copied into read-only space and/or shared with other
programs.
What this means to me, in the context of the way we implement
write-protection of constants, is that any data structures consed up as a
result of the evaluation of the form is permitted to be done in the
write-protected area. Thus, it would not be permissible to do something
like:
(let ((x '#,(list ...)))
(setf (car x) ...))
However, in your case where the effect of the evaluated form is to return a
pointer to an already existing array, that array continues to exist in
whatever memory area it was in before, so there is no prohibition against
changing its contents. We don't actually do write-protection of #, values,
but this seems to say that it wouldn't prevent you from doing what you want
anyway. Of course, though, if you create the array on the first reference,
then you would have a problem if it got created in the write-protected area.
Also, the description of READ-ONLY-P T goes beyond the behavior I envisioned,
since it permits copying the value, which I would have to agree doesn't sound
desirable.
That then leads me to wonder whether the semantics should be to simply always
permit modification, or whether the READ-ONLY-P option really is needed.
After being forced to think about this more deeply and re-reading the
proposal, I am now more favorably inclined towards the proposal
LOAD-TIME-EVAL:NEW-SPECIAL-FORM. Even the change to use #, outside of ' is
beginning to make more sense. The only serious objection I have left is that
the name LOAD-TIME-CONSTANT ought to be changed since the word "constant"
seems misleading. Maybe something like EVAL-AT-LOAD-TIME ?
-- David Gray