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

intercepting undefined function errors

    Date: Wed, 5 Aug 87 20:45 EDT
    From: David L. Andre <DLA@diamond.s4cc.symbolics.com>

	Date: Wed, 5 Aug 87 15:44 EDT
	From: Brewster Kahle <KAHLE@Think.COM>

	    Date: Wed, 5 Aug 87 12:34 EDT
	    From: Jeffrey P. Golden <jpg@allegheny.scrc.symbolics.com>

	    We are running Beta Version 2.00 on the Apollo.

	    As you may know, MACSYMA has long had an "autoload" feature 
	    whereby an "undefined function" may have an AUTOLOAD property 
	    which indicates a file which contains the function's definition. 
	    The file is loaded when a call to the undefined function is 
	    attempted.  (This scheme was very useful in the days of limited 
	    address space.  It is still used to autoload a few "share" files.)

	I wrote a local hack that does the same thing, but in a different way:
	Vdefun takes a function-name and a file-name (or system name).  It
	creates a function that has the same name and takes &rest args.  The
	function loads the file and recalls the function.  This takes alittle
	more space than the maclisp property method, but it has the advantage that it
	the compiler does not complain of undefined functions, it is easy to
	write, and it works on any commonlisp.

    I guess you would have a NOTINLINE declaration for the recursive call,
    so that the compiler doesn't generate tail recursion.

This point about the use of NOTINLINE is very good, but I want to
clear up a point of terminology: "tail recursion" simply means that
the call is effected without net long-term growth of stack.  What is
meant here is something a bit stronger, namely that the compiler
translates a call as a jump back to the head of the code without
bothering to look in the function cell (which might have changed).
NOTINLINE is a reasonable means of suppressing that.