Tracing functions (and bug 2595)



In bug 2595[1], the reporter points out that $TRACE doesn't work very
well on functions with quoted arguments. A simpler example than the
original report is the following:

    (%i39) fun ('var) := var;
    (%o39)                         fun('var) := var
    (%i40) x: 1$

    (%i41) fun(x);
    (%o41)                                 x
    (%i42) trace(fun)$

    (%i43) fun(x);
    1 Enter fun [1]
    1 Exit  fun 1
    (%o43)                                 1
    (%i44) untrace(fun);
    (%o44)                               [fun]

The problem is that the way $TRACE is implemented completely ignores the
possibility that the original function was defined with one or more
quoted arguments. I don't know the history here: was trace written
before the introduction of the "fun('var) := ..." syntax?

Anyway, I was wondering if any more senior developers had a good idea of
how to make this work correctly. A rather hacky solution that occurred
to me was to use something like the MFEXPR* case in the enormous MEVAL1
cond and make the stub function that calls the trace code also deal with
expanding (some of) its arguments. But that's pretty horrible. Anyone
got a better idea?

Rupert

[1]  https://sourceforge.net/p/maxima/bugs/2595/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20130701/916d82a6/attachment.pgp>;