Subject: Re: trace calls from within mapcar or similar functions
From: Erik Naggum <erik@naggum.net>
Date: Mon, 06 Aug 2001 20:34:56 GMT
Newsgroups: comp.lang.lisp
Message-ID: <3206118893924779@naggum.net>

* "Martin Simmons" <znegva@xanalys.com>
> In LW, TRACE and UNTRACE modify the symbol function cell, not the
> original function object.  I'm not sure if it is conforming or not, but
> the reason that #' returns the original function object is to prevent the
> tracing function getting stuck in some data structure making it
> impossible to untrace.
> 
> E.g.
> 
> (defun foo ())
> (trace foo)
> (setq *foo* #'foo)
> (untrace)
> (funcall *foo*)   ; would it be useful if this printed trace info for ever more?

  If you could add something in or to the function object itself to cause
  tracing, you would obviously remove it upon untracing, just like you
  would for the functional value cell of the symbol.  This requires that
  the function object is more than just some code.  In every Common Lisp
  implementation I have seen, this is the case.  From a casual inspection
  of LispWorks for Linux, it appears to be true there, too.  Even if you
  redefine the function after it has been requested traced, you can make
  sure the trace flag is turned off if you remember which function objects
  you have modified for what reason.   ///