[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: issue LOAD-TIME-EVAL



> > Date: Tue, 10 Jan 89 00:20:32 GMT
> > From: Jeff Dalton <jeff%aiai.edinburgh.ac.uk@NSS.Cs.Ucl.AC.UK>
> > 
> > >    In interpreted code, (LOAD-TIME-VALUE <form>) is equivalent to (VALUES
> > >    (EVAL (QUOTE <form>))).
> > 
> > Surely not, [... mistaken comment ...]
> 
> Perhaps I can rephrase this.  I seem to remember having tried once
> before but apparently things got even more messed up in the process.
> The idea is that evaluation takes place in a null lexical environment,
> that it's performed by EVAL, and that exactly one value is returned. 

I was confused.  Quoting forms is ok (even, I now thing, self-evaluating
ones).

> > >    Note that, in interpreted code, [...] Since successive evaluations
> > >    of the same LOAD-TIME-VALUE expression may or may not result in an
> > >    evaluation which returns a "fresh" object, destructive side-effects
> > >    to the resulting object may or may not persist from one evaluation
> > >    to the next.
> > 
> > This sort of defeates the purpose of :READ-ONLY-P NIL.
> 
> I'm not sure exactly what problem you have here.  :READ-ONLY-P NIL
> says that it's OK to bash the object destructively, which is sometimes
> useful even if such destructive side-effects are not persistent. 

That's probably why I said "sort of".  It makes it noticeably less
useful and (more important) different from what happens in compiled
code.  But you're right that it's still useful.

> > I don't understand what this explicit initialization is or why it helps.
> 
> OK, here's an example.

Ah, I see.  It helps because the programmer might have thought there
would be a new object each time.  It doesn't help when the same object
is what's wanted, which is the case I was thinking of.

I guess what bothers me still is that the benefits of compilation
turn out to be somewhat strange.  The programmer wants to write code
that will work if there's a new object each time but can still benefit
if there isn't.

> A previous paragraph says that it's OK to evaluate LOAD-TIME-VALUE forms
> only once.  This is to clarify what "only once" means -- once per
> reference.

OK.

> > You might cite reasons, even if only by a phrase or two.  (I'm never
> > happy when all I'm told is that "some people think it's essential".)
> 
> That particular phrase is Kent's.  I've long ago given up on trying to
> read Kent's mind :-), so he'll have to provide his own explanation.

I think there's some mail, but I'm having trouble finding the one
I want.

-- Jeff