[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Tracing locally defined functions

    Date: Fri, 26 Jun 87 16:18 EDT
    From: "Dan Corkill A356 LGRC (413)545-0156" <CORK%cs.umass.edu@RELAY.CS.NET>
    A better solution would have implementers augment TRACE with the ability to
    trace locally defined functions that are defined within a function:


    where TRACE would be smart enough to also trace any functions defined by FLET
    and LABELS.  Specific functions might also be an option:

    (TRACE factorial :LOCALLY-DEFINED-FUNCTIONS '(factorial-helper)).

    Does anyone's implementation of TRACE handle LABELS or FLET?

    -- Dan Corkill

(trace 'foo) would have to refer to the global value.  One simple
technique for tracing from inside a program would be to a
(TRACEF place).

The real problem is that Common Lisp thinks that all functions can
be named with symbols.  This just isn't the case.  Function names
are inherently structured objects.  Our function specs allow us
to trace not just internal functions, but functions living on
property lists, in flavor method tables, in type descriptor objects,
etc. etc.  In general, they are either a symbol (i.e. the trivial
CL usage), or (<type> <primary-name> . <additional info>)

For example, (flavor:method open-the-door door)
refers to the function which implements the OPEN-THE-DOOR
operation for a DOOR flavor.  Another benefit is that the
user doesn't have to know where it's stored or how to get
at it.

Unfortunately, our :INTERNAL function-spec type is a little
awkward; you have to know an internal index.  For anonymous
lambdas, this makes sense, and the index is zero-origin, so
it's not that hard to deal with, but you'd like to be able to
skip the index when it's unambiguous.

For example, your FACTORIAL-HELPER internal function would
in our system.  A better scheme would be:

(:INTERNAL FACTORIAL FACTORIAL-HELPER 0), where the 0 is optional,
so long as there's just one FACTORIAL-HELPER local function.

I think we proposed this years ago, but nobody saw the need
back then.  Perhaps now there's enough experience with the
language to let us adopt something like this?