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

**DRAFT** issue COMPILED-FUNCTION-REQUIREMENTS, version 2



    One possible use of the COMPILED-FUNCTION type is in declarations.  Are
    there any implementations which have a distinguished representation for
    COMPILED-FUNCTIONs, that use type declarations to compile calls to these
    functions more efficiently?

While there may not be such currently, it seems like a very useful
optimization to encourage.  MacLisp had a SUBRCALL function, which was
just like FUNCALL but required its first argument to be a compiled
function, and it seems like any Lisp for conventional processors could
make use of such an optimization.  Many implementations already provide
"block compilation", and (FUNCALL (THE COMPILED-FUNCTION x) ...) could
potentially be as fast as a call to a named function in the caller's
compilation unit (maybe slightly slower because a COMPILED-FUNCTION
might be lexical, so the lexical environment would probably have to be
passed as an implicit argument).

Embedded language systems could probably make good use of such a
declaration, too.  For example, a PROLOG implementation that turns
predicates into Lisp functions and always compiles them could use the
above.

Here's another portable application I thought of, but it's not quite as
clear-cut.  A program might want to FMAKUNBOUND a bunch of macros that
it knows are only used in a limited number of functions.  It could check
whether all those latter functions are compiled, and if so it knows it
is safe.

                                                barmar