4 ms·
It's a great rule for any metaprogramming task. When writing a macro, or reflective intercession, make it a shim that wraps non-metalevel code, so it's decouple
by agumonkey 11y ago
It's a great rule for any metaprogramming task. When writing a macro, or reflective intercession, make it a shim that wraps non-metalevel code, so it's decoupled, testable and yes debuggable.
- ra88it 11y agoInteresting. Do you have an example or a link to an example?
- agumonkey 11y agoI can't find the exact quote nor site, but it's a common advice in lisp tutorials to write the macro as thin as possible and split its internal logic as tiny composable functions (the usual desired lisp/engineering style). The rest comes from my small experience, in college we had a project patching java bytecode on the fly, you could generate correct logic at the bytecode level, but you would lose all the benefit of high level language (typechecking, debugging). One team had this excellent idea to just write the smallest bytecode hook/wrapper that would then call normal Java code.