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

Open
#211 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp, r
Domain
api

Research direction

Start with the cpp11::sexp API and the original discussion in pull request 209. Determine how the requested inspect() accessor should represent SEXP values and how the optional depth limit should behave. Done means both example calls return usable debug strings with bounded inspection for the depth overload.

Written by the indexing model from the issue text.

Description

feature

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
Dominant language
C++
Stars
224
Forks
52
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from r-lib/cpp11

All issues in r-lib/cpp11

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.