cpp11 icon indicating copy to clipboard operation
cpp11 copied to clipboard

Add a debug string representation accessor to `cpp11::sexp`

Open bkietz opened this issue 4 years ago • 0 comments
trafficstars

It'd be helpful for error messages, logging, and other debugging to have easy access to a string representations for SEXPs in C++. This could return the equivalent of .Internal(inspect(some_sexp)) or capture.output(print(some_sexp)).

See original discussion here: https://github.com/r-lib/cpp11/pull/209#discussion_r674209915

cpp11::sexp value = ...
std::string str = value.inspect();
std::string str = value.inspect(/*depth=*/2); // limit inspection of sub objects

bkietz avatar Jul 23 '21 13:07 bkietz