constructive icon indicating copy to clipboard operation
constructive copied to clipboard

Support "bytecode" type

Open moodymudskipper opened this issue 7 months ago • 1 comments

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.

moodymudskipper avatar Mar 17 '25 15:03 moodymudskipper