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

Issue: DECLARATION-SCOPE (Version 2)



I support DECLARATION-SCOPE:LIKE-VARIABLE, but I have some related
issues I'd like to ask about while we're on the topic. I wonder about
the following cases. Do we believe that they all follow clearly from the
indicated rules (and/or other known and agreed upon rules)?

(DEFUN FOO-1 (X)
  (DECLARE (INLINE FOO-1))
  (+ X 1))

(DEFUN BAR-1 (X) (FOO-1 X))

Can FOO-1 be inlined in BAR-1? I say no because of modularity and 
incremental debugging constraints. I think there are implementations
which do this inlining. I would like to see this and other situations
treated explicitly.

(DEFUN BAR-2 (X)
  (FLET ((FOO-2 (X)
	   (DECLARE (INLINE FOO-2))
	   (+ X 1)))
    (FOO-2 X)))

Can FOO-2 be inlined in BAR-2? I say it's not totally unreasonable
and I wouldn't be surprised if some implementations have resorted to
this as a way for users to say that FOO-2 is inline since they cannot
put the information at the top of the FLET body. I found the wording
of this proposal to be a little vague on whether this INLINE
declaration spans the whole FLET, but my final impression was that
it does. Is this right? Can we get this into the spec?

Other examples I'd like to see made explicit:

(DEFUN FOO-3 (X)
  (DECLARE (FUNCTION FOO-3 (FIXNUM) FIXNUM))
  (+ X 1))

(DEFUN BAR-3 (X)
  (THE FIXNUM (+ (FOO-3 X) 1)))

Can I use fixnum arithmetic in FOO-3? (I say yes.)
Can I use fixnum arithmetic in BAR-3? (I say no, to avoid
problems if one function is changed while the other is not.)

(LABELS ((FOO-4 (X)
	   (DECLARE (FUNCTION FOO-4 (FIXNUM) FIXNUM))
	   (+ X 1))
	 (BAR-4 (X)
	   (THE FIXNUM (+ (FOO-4 X) 1))))
  (FLET ((BAZ-4 (X) (THE FIXNUM (+ (FOO-4 X) 1))))
    ...))

Can I use fixnum arithmetic in FOO-4? in BAR-4? In BAZ-4?
I hope yes to all.