Matthew D Swank writes:
> Alastair Bridgewater wrote:
>> Not being a fan of any of the implementation sketches thus far supplied,
>> I thought I might throw my hat in the ring... But I'm not overly pleased
>> with my implementation either, due to the fact that it contains some code
>> duplication (the handler-case for the restart) and the fact that it
>> doesn't cover the (setf macro-function) case.
> Actually, I was able to use the restart with (setf macro-function):
> * (setf (macro-function 'bar) #'p)
Not where I was going with that. That's still a bare global function
reference. If you look at the definition of (setf sb!xc:macro-function) in
src/compiler/info-functions.lisp, you will see it set the symbol-function of
the symbol to a lambda that raises undefined-function without the restart.
A couple other notes about my patch: It's x86-specific for now due to the
small amount of backend hacking (trivial to port over), I'd definately do
the interr hacking differently were I to do it again (I'd use the same
&write hack as I did for the symbol-value restarts; I did the current damage
before realizing what the safe-fdefn-fun VOP did, and then paid for it with
the noise of changing the name of a bunch of arguments to various deferr
functions), and the incremental cost for error recovery code is three bytes
per reference to a function as a global variable (that is, a bare reference
to #'foo as above), which are on the error path only (%coerce-name-to-fun
doesn't appear to be inlined, so that's not an incremental cost).