From: Peter Blicher
Subject: how to define compile time aliases?
Date: 
Message-ID: <2t62gc$svj@news.parc.xerox.com>
I have never been able to find a satisfactory solution to the following problem, of
how to define an alias (in common lisp of any stripe) which will keep the compiler
happy:

Suppose you have a file in which you have defined func1, which might be a function
or a macro.   Later in the file you want to assert that func2 means the same thing
as func1, such that yet later in the same file, you can use func2.  The file is
then to be compiled with compile-file to produce a loadable binary.

(defmacro func1 (...) ....) ; define a macro named func1
(defsynonym func2 func1)   ; assert that func2 is henceforth same as func1
(.... (func2 ....)....)    ; now use func2
...
(defun      func3 (...) ....) ; define a function named func3
(defsynonym func4 func3)   ; assert that func4 is henceforth same as func3
(.... (func4 ....)....)    ; now use func4

Later on (e.g. after this is all loaded), it should be the case that
(eq (symbol-function 'func2) (symbol-function 'func1)) -> T,  or at least that 
(eq (function-information 'func2) (function-information 'func1)) -> T, so that, e.g. 
things that the user uses as functions will appear in backtraces, have stack
frames, and, most importantly, can be funcalled, mapped, and applied.  If it were
not for the latter, defsynonym could just be defined as a macro defining the alias
as a macro.  It would also be nice if invoking func4 were as efficient as invoking
func3.

(It is not important whether later saying 

(setf (symbol-function func<i>) <something>) 

should have any effect on func<j>, such as making it also be <something>.)

The question is how to define defsynonym in such a way that this will work
portably.  The hangup seems to be that I am demanding that the user not have to
wrap eval-whens around stuff.  This combines with the problem that one has to find
the macro-function of a symbol before the file defining it has been loaded.  Near
as I can tell, cltl1 or 2 are mute on what macro-function should return at compile
time.

Can anyone tell me the solution to this, or make a convincing argument that a
solution is impossible?

--peter