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


References:	CLtL p. 156, 159
Edit History:   16 Sept. 88 V1 by David Gray
Status:		For preliminary discussion 
Problem Description:

  CLtL does not specify whether a (PROCLAIM '(INLINE ...)) should come
  before or after the DEFUNs that it refers to, but in most
  implementations the compiler can't expand a function inline
  unless it knows at the time it processes the DEFUN that the definition
  needs to be saved for use in inline expansion.
  Clarify that (PROCLAIM '(INLINE ...)) tells the compiler both that it is
  desirable to use inline expansion for calls to the functions indicated
  and that the compilation of any subsequent DEFUN of one of the functions
  should record whatever information is used for performing inline
  expansions.  Consequently, the proclamation should precede the
  definition of the functions that it names.  When compiling a function
  call, if the function has been proclaimed INLINE but the current
  definition of the function was established before the PROCLAIM was
  processed, it is implementation-dependent whether the function will
  actually be expanded inline.


  This clarification brings the specification in line with current
  practice.  The only alternative would appear to be to require the
  compiler to always save the definition of every function, and that
  doesn't seem reasonable.

 Test Cases/Examples: 

  Given the following input to COMPILE-FILE, does F1 get expanded inline
  in F2?

    (defun f1 (a) (+ a 100))
    (proclaim '(inline f1))
    (defun f2 (b) (f1 b))
 Current Practice:
  The documentation for Lucid and the TI Explorer both say that INLINE
  proclamations need to precede the function definition.  Symbolics
  doesn't appear to document this, but requires it anyway.  Thus none of
  these three implementations do the inline expansion in the example

 Cost to implementors:
  Probably none required, although given this clarification it would be
  nice if compilers warned about an INLINE proclamation that follows the
  indicated DEFUN in the same file.

 Cost to users:


  Users will know how to use INLINE proclamations correctly.

 Costs of Non-Adoption: 

  Continued confusion over cases such as the example above, which
  conform to CLtL but don't do what is expected.