+ William Brew <[EMAIL PROTECTED]>:

| Using typep or compiled-function-p on an interpreted function seems
| to return the wrong answer -- they think that the interpreted
| function is compiled.

This is OK, according to the HyperSpec:

  Any function may be considered by an implementation to be a a
  compiled function if it contains no references to macros that must
  be expanded at run time, and it contains no unresolved references to
  load time values. See Section 3.2.2 (Compilation Semantics).

  Functions whose definitions appear lexically within a file that has
  been compiled with compile-file and then loaded with load are of
  type compiled-function. Functions produced by the compile function
  are of type compiled-function. Other functions might also be of type
  compiled-function.

Given that the spec allows so much leeway in what may be called a
compiled function, the obvious question is:  What is the most useful
behaviour of compiled-function-p?  CMUCL has opted for this:

* (subtypep 'eval:interpreted-function 'compiled-function)
T
T

I am not sufficiently fluid in Lisp to easily create a function which
contains references to macros that must be expanded at run time, or
which contain unresolved references to load time values.  If you know
how to make such things, you should repeat your test with these.  And
it does seem reasonable to me this is a more important property to
test than merely whether the function exists as machine code or not,
since it can have semantic consequences.

- Harald

Reply via email to