enaeher / contrail Goto Github PK
View Code? Open in Web Editor NEWAn interactive tracing facility for Clojure
License: Eclipse Public License 1.0
An interactive tracing facility for Clojure
License: Eclipse Public License 1.0
This would allow you to trace only those calls to a given function where another function is on the stack.
Right now, you can bind *out*
, but there is no way to redirect only the trace output without also redirecting other output.
To wit:
contrail.core-test> (def foo identity)
#'contrail.core-test/foo
contrail.core-test> (trace #'foo)
#'contrail.core-test/foo
contrail.core-test> (pmap foo (range 5))
0 000 ::0:: : (#'contrail.core-test/foo 3)(#'contrail.core-test/foo 0) (#'contrail.core-test/foo 1)(#'contrail.core-test/foo 2) (#'contrail.core-test/foo 4)
0 00::: #'contrail.core-test/foo returned 30 0#'contrail.core-test/foo returned 1 #'contrail.core-test/foo returned 0:
:
#'contrail.core-test/foo returned 4#'contrail.core-test/foo returned 2
(0 1 2 3 4)
Compare with clojure.tools.trace
:
contrail.core> (clojure.tools.trace/trace-vars foo)
#'contrail.core/foo
contrail.core> (pmap foo (range 5))
TRACE t112227: (contrail.core/foo 1)TRACE t112228: (contrail.core/foo 3)TRACE t112230: (contrail.core/foo 2)
TRACE t112229: (contrail.core/foo 4)
TRACE t112231: (contrail.core/foo 0)
TRACE t112231: => 0TRACE t112227: => 1
TRACE t112230: => 2
TRACE t112229: => 4
TRACE t112228: => 3
(0 1 2 3 4)
Improve :report-before-fn
and :report-after-fn
protocols so that the user doesn't need to know so much about Contrail internals to handle common cases
When a var is redefined (e.g., by a user re-compiling a file or expression in their editor), the trace reporting wrapping of its function is blown away, and so traced-vars
becomes out-of-sync with the true state of things.
I see three possible solutions:
traced-vars
untrace
(this is what SBCL does, at least by default)traced-vars
and instead rely on var introspection (of all vars in all namespaces) to support the functionality of all-traced
, zero-arity untrace
, etcExample:
0: (#'contrail.core/foo )
0: #'contrail.core/foo returned nil
This would let you limit trace output to the first n calls to the traced function.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.