Re: function redefinition, was: redefining macro as a function?



--- Robert Dodier  wrote:

> In some sense all functions are subject to redefinition
> at any time, since there nothing to stop a programmer
> from doing (setq save-meval (symbol-function meval))
> (defun meval (x) (cond (...) (t (funcall save-meval x))))
> whenever they feel like it.

Hmm.  That possibility had not occurred to me.  I apologize Robert - I
have a feeling I might be basing my arguments on an insufficiently
skilled knowledge of lisp to make intelligent arguments.  I have two
questions:

a)  Would the above mechanism work for redefining the behavior of
defmfun statements as well as defun?  I am concerned this might be a
bit trickier - my understanding was that defmfun contained some special
logic to define an active command in the Maxima environment.  Would
this complicate things?

b)  Since toplevel-macsyma-eval is currently a macro, my guess would be
that there isn't an available equalivent to the above which would work.
 Could we at least replace the defmacro with an equalivent defun for
defining toplevel-macsyma-eval?  I still am personally of the opinion
that we should add flags to the default loop, but even if I just
redefine it in my package to date I have not found a way to redefine
the toplevel macro as a function after compile has expanded it out. 
Perhaps this is just a lack of skill.
 
> By the way multiple redefinitions chain together in this
> scheme -- if package 1 is loaded then package 2, package 2's
> redefinition punts to package 1's, which punts to the
> original definition. No extra work to do here and if I'm
> not mistaken this is just what we want.

Yes, this looks quite useful.  I will try to update my redefinitions to
use this technique.  

Cheers,
CY


		
__________________________________ 
Discover Yahoo! 
Stay in touch with email, IM, photo sharing and more. Check it out! 
http://discover.yahoo.com/stayintouch.html