constructive
constructive copied to clipboard
Support "bytecode" type
bytecodes can be created with compiler::compile()
The code to use in compile() can be fetched from res <- compiler::disassemble(x) in res[[1]][[3]]
The doc should mention it's not rigorously the same, because it points to another address etc
There are options used for compilation but I'm not sure we can retrieve those.
Additionally cmpfun() can be used to compile the body of a function, but we can't access the bytecode object directly with body() or even as.list().
However .Internal(bodyCode(x)) will fail if the function is not compiled, so we can use it to test if it is compiled or not, and use cmpfun() on top of it.
I don't know if we need this by default, it will change some snapshots and it's not super useful or even always exact since we don't provide the compiler options, but providing an arg in opts_function would make sense.