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

issue LOAD-TIME-EVAL, version 11



Summary:  I must be missing something...

   Posted-Date: Mon, 20 Mar 89 15:46 EST
   Date: Mon, 20 Mar 89 15:46 EST
   From: David A. Moon <Moon@STONY-BROOK.SCRC.Symbolics.COM>

       Date: Sun, 19 Mar 89 22:18:17 CST
       From: alarson@src.honeywell.com (Aaron Larson)

       I find myself strongly opposed to **3.

   Read Sandra's answer first.

Well, I appear to be out of it.  I've been thinking this over for the last
two days, and I still don't get it.  My mental model of what
LOAD-TIME-VALUE gives me is syntactic sugar.  E.g.

   (defun foo () .... (load-time-value XXX) ...)

could be (assuming DEFINING-MACROS-NON-TOP-LEVEL):

   (let ((val XXX))
     (defun foo () ... val ...))

My understanding of its need is that it can be difficult for macros to
expand into something like the above without a fair amount of cooperation
 from the "top level" defining macro.

  From Sandra:
	  (flet ((foo () (load-time-value (bar))))
	    (declare (inline foo))
	    (list (foo) (foo)))

I personally don't see what the inlining example has to do with the issue
at all.  If I have a function defined like the following:

  (let ((val (make-array ...)))
    (defun bar () val))

it seems reasable for the compiler to put a constant value in the body of
bar, but if I then declare it to be inline, I don't see how the compiler
can propagate the constant unless it can ensure that the values it
propagates will always be EQ (for example if it is inlined into functions
 from different files, the loader has to be smart enough to make the
constants one and the same at load time, or the inlining operation is not
legal).  I would think that the fact LOAD-TIME-VALUE is a special form
encompases this sort of analysis for its resultant value in an analagous
manner.  

The talk about EQ structures being coallesced I've always considered bogus,
LOAD-TIME-VALUE denotes a way of computing a value, the fact that it is
somehow not evaluated the next time around is a property of where it
appeared in code, not the identity of the cons cell that made it up.  For
example, is anyone considering that it would be legal to have only one
load-time-value expressing in the following:

   (defun foo (x)
     (if x
         #1=(load-time-value ....)
	 #1#))

My take of the **3 proposal is that foo could become a constant function,
that seems wrong to me, hence I believe the following two programs denote
different computations (the first foo being a constant function, the second
one not):

   (defun foo (x)
     (flet ((bar () (load-time-value XXX))))
       (if x (bar) (bar)))

   (defun foo (x)
     (macrolet ((bar () '(load-time-value XXX))))
       (if x (bar) (bar)))


Moon Again:

   The problem is that the **2 proposal is not well specified and thus
   cannot be implemented, or will require the implementor to make arbitrary
   decisions that will probably come out different ways for different
   implementations.

   Thus I think it's incumbent on anyone who opposes **3 to propose an
   alternative, and I think just going back to **2 is not a viable
   alternative.

I guess my problem is that I don't see the implementation lattitude
that you do.  Undoubtedly this comes from your far greater experience.
Since we will be in DC in a few days, perhaps someone can take a few
minutes (hours?) to explain it to me.  I'll even buy the beer.