User loginNavigation |
First-Class Traces
Some development environments provide a tracer, which allows you to
observe the entering and exiting of function calls[1].
E.g. in Common Lisp you can do:
which could output
As you can see, the macro Thus, continuing the above example, such a `trace' data structure
might roughly resemble
Since I could not find anything about this, I was wondering the
following: are there any languages (or easy ways of implementing it
yourself) that can reify traces as data structures such as above
that you can manipulate? In case you are wondering, there are
potentially many reasons why this might be useful. E.g. one might like
to compare two traces, or store a trace for later, or even consider the
trace itself as a kind of higher-level program (although I have not
investigated this idea in depth).
Note that I am not referring to `stack traces' (a.k.a. `backtraces'). The
stack trace at the execution of location X above might be a structure
resembling
Debuggers usually already provide many ways of manipulating
the stack trace after e.g. a exception or breakpoint (although I do not know
which ones are able to reify it...). Also, as I recall, one
simple way of implementing continuations is copying the stack (which is
part of the continuation) to the heap. So stack traces are not the
issue here, nor are the `traces' as the word is sometimes used in
theoretical computer science (sequences of successive states of some
state transition system).
[1]
It is actually an interesting question what it would mean to trace
operators other than functions, but I did not go into that here. By xyzzy at 2006-04-28 20:45 | LtU Forum | previous forum topic | next forum topic | other blogs | 12937 reads
|
Browse archives
Active forum topics |
Recent comments
27 weeks 2 days ago
27 weeks 2 days ago
27 weeks 2 days ago
49 weeks 3 days ago
1 year 1 week ago
1 year 3 weeks ago
1 year 3 weeks ago
1 year 5 weeks ago
1 year 10 weeks ago
1 year 10 weeks ago