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



--- C Y  wrote:
> --- 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.

> a)  Would the above mechanism work for redefining the behavior of
> defmfun statements as well as defun?

As far as I know, it should work the same for defmfun's 
as well as defun's.

About defmfun, if I'm not mistaken it doesn't do anything 
significant and its presence is more a convention than a 
requirement. User-level Maxima functions can be defined
equally well by defun or defmfun.

> 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.

There might be a variation of the above snippet 
that works for macros but I don't know for sure. 

> Could we at least replace the defmacro with an equalivent
> defun for defining toplevel-macsyma-eval?

I don't see any problems there.

For what it's worth,
Robert Dodier

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com