4 ms·
I don't have a macroexpand function and the self-imposed limit on the number of primitive functions (32 language-related + 16 OS-related) has already been reach
by frou_dh 10y ago
I don't have a macroexpand function and the self-imposed limit on the number of primitive functions (32 language-related + 16 OS-related) has already been reached! Having a whitelist for macros whose expansion should be traced would be good as there's a lot of noise.
"Non-intrusive" tracing of any expression can be done, using an @ prefix, based on this:
(extend-parser
"@"
(mac (x)
`(let once ,x
(seq (eprintln "TRACE: " once)
once))))
e.g.
(def third (div 100.0 3.0))
=> TRUE
(add @(mul third 2.0) third)
TRACE: 66.66666666666667
=> 100.0
That's a good point that you mention tracing needing to be toggleable - it'd be nice to be able to leave all the @s in code. I guess the macro for "@" could either be conditionally replaced with an effective no-op, or it could internally check for the existence of (or truthiness of) a global tracing-enabled definition.