-
-
Notifications
You must be signed in to change notification settings - Fork 70
Open
Labels
Description
At the moment, re-frame and reagent are the only sources of trace. How about we allow the application programmer to produce their own trace, and have it folded into the stream for later inspection.
Hmm. Strictly speaking this is a re-frame
issue more than a re-frame-trace
issue, I think, but it makes sense to track it here.
Perhaps have tracing macro utilities which make it even easier for programmers to produce trace.
As an example, consider this dlet
macro:
;; From e.g. https://github.com/scottjad/uteal
(defmacro dlet
"let with inspected bindings"
[bindings & body]
`(let [~@(mapcat (fn [[n v]]
(if (or (vector? n) (map? n))
[n v]
[n v '_ `(println (name '~n) ":" ~v)]))
(partition 2 bindings))]
~@body))
which allows use like:
(dlet [a (something :a) ;; note use of `dlet` instead of `let`
b (f "hello")]
... )
Now imagine that dlet
produced trace
instead of using println
. And imagine that the trace is recorded against the event handler (or subscription) in which this dlet
was used. Maybe call it tlet
for trace let.