← Back to all sparks
L

lobstr

ANALYTICS
Velocity0.0

Understanding complex R objects with tools similar to str()

R's object inspector is losing its view of the internals as CRAN closes off the private C API.

r-libintrospectionmemoryc-apir-internalsr-package
Current state
lobstr exposes R's internal object representation — sizes, addresses, reference counts, abstract syntax trees. Its two most recent releases are both driven by R's move to a restricted public C API: 1.1.3 stopped reporting a vector's truelength and reworked the reference indicator into refs:n, and 1.2.0 changed what sxp(expand = "environment") shows in order to stay compliant. 1.2.0 also adds src() for exploring srcref objects.
Where it's heading
The package is being rebuilt inside a shrinking window of what R permits. Each release trades some introspection depth for API conformance while trying to keep the diagnostic value intact — showing promise expressions instead of internal frame structures, replacing named with a documented refs scale. Where the constraint does not bite, development continues normally: src() is genuinely new, and the environment-binding fixes remove long-standing errors on for-loop and immediate bindings.
Prediction
Expect further conformance work, since the notes describe it as ongoing, with any remaining non-API-dependent readouts either reworked or dropped as R tightens further.

Recent moves

  1. 5mo ago

    New src() for srcrefs; environment bindings stop erroring

    src() arrives for exploring srcref and srcfile objects, with documentation of what the maintainers know about them. obj_size(), obj_addrs() and sxp() no longer throw "bad binding access" on for-loop and immediate bindings, and sxp() hides internal frame structures to stay within R's public C API.

    View source ↗
  2. 9mo ago

    truelength reporting dropped for public C API compliance

    ⚡ SPARK

    R's public API restrictions cost lobstr the ability to report a vector's truelength, and the named indicator is replaced by an refs:n scale mapped to NO_REFERENCES and MAYBE_SHARED. For an introspection tool, this is the release where the platform started deciding what can be seen.

    View source ↗
  3. 4y ago

    Moves to cpp11, relicensed MIT, adds experimental tree()

    The C++ layer switches from Rcpp to cpp11 and the package is relicensed as MIT. obj_size() gains human-readable units and stops returning NA above 2^31 bytes, and an experimental tree() lands as an alternative to str().

    View source ↗
  4. 7y ago

    PROTECT error fixed

    A PROTECT error is fixed and UTF-8 characters removed from comments. Compilation-level housekeeping.

    View source ↗
  5. 7y ago

    ALTREP sizes computed correctly; obj_addr() stops side-effecting

    obj_size() handles ALTREP objects correctly on R 3.5.0 and obj_addr() no longer increments its input's reference count — a real problem for a tool whose job is reporting reference counts. ast() also prints scalar integers and complex numbers more accurately.

    View source ↗