Open mike-thompson-day8 opened 6 years ago
Maybe this could be a single tap handler that observes re-frame's state.
Any macros would simply wrap parts of your code with (tap>)
. That could easily be its own concern, not dependent on 10x.
To record not just an evaluation, but the literal form as well, is a cool idea. I think shadow-cljs does that.
(defmacro tlet
"let with tapped bindings"
[bindings & body]
`(let [~@(mapcat (fn [[n v]]
(if (or (vector? n) (map? n))
[n v]
[n v '_ `(tap> [(name '~n) ~v)]]))
(partition 2 bindings))]
~@body))
@mike-thompson-day8
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 are-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:which allows use like:
Now imagine that
dlet
producedtrace
instead of usingprintln
. And imagine that the trace is recorded against the event handler (or subscription) in which thisdlet
was used. Maybe call ittlet
for trace let.