trace is not a proper function operator but it has interesting features, we should not use trace though, but it could be named tracing and use body<- borrowing the arguments from trace.
to modify formals we can either have a different function integrate it in, then we need to decide if the name tracing is general enough :
why it would not be : tracing is not about editing formals, if I just want to edit formals, using a function named tracing is awkward
why it would be : you rarely would want to edit formals without editing the body, so the formal editing feature is just a handy addon
We can probably go on with tracing, with parameters :
tracer : as in trace
at : as in trace
exit : as in trace
formals : NULL by default (use alist() orlist()` to assign empty formals),
body : NULL by default, (use quote() to assaign empty body), either a body replacement or a function/formula to apply on the existing body, for example I might want to substitute all list calls by rlang::list2 calls to support quasi quotation etc...
for this last example we'd need to see how we do it, maybe we need a helper function tu substitute stuff while keeping a simple syntax.
trace
is not a proper function operator but it has interesting features, we should not usetrace
though, but it could be namedtracing
and usebody<-
borrowing the arguments fromtrace
.to modify formals we can either have a different function integrate it in, then we need to decide if the name
tracing
is general enough :tracing
is awkwardWe can probably go on with
tracing
, with parameters :trace
trace
trace
alist() or
list()` to assign empty formals),quote()
to assaign empty body), either a body replacement or a function/formula to apply on the existing body, for example I might want to substitute alllist
calls byrlang::list2
calls to support quasi quotation etc...for this last example we'd need to see how we do it, maybe we need a helper function tu substitute stuff while keeping a simple syntax.