Skip to content

Use conformant API to iterate over environments#89

Open
lionel- wants to merge 3 commits intobugfix/env-iterationfrom
task/env-api
Open

Use conformant API to iterate over environments#89
lionel- wants to merge 3 commits intobugfix/env-iterationfrom
task/env-api

Conversation

@lionel-
Copy link
Member

@lionel- lionel- commented Feb 4, 2026

Branched from #88.
Follows same approach as #88.

Unfortunately this means we are less precise in terms of object properties (references etc) because we can no longer get our hands on the intermediate nodes such as promises.

@lionel-
Copy link
Member Author

lionel- commented Feb 5, 2026

Last commits also refactor construction of inspector node with a shared ctor.

Introduction or formalisation of the notions of:

  • Display type and display value (optional): <type: value> or <type>
  • Placeholder nodes. For these we don't show the sxpinfo (refs)
  • NILXP is now a placeholder node, alongside the missing value and environment bindings (promises, active bindings).

#'
#' * "character" to show underlying entries in the global string pool.
#' * "environment" to show the underlying hashtables.
#' * "environment" to show binding components without any side effect (e.g. promise).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#' * "environment" to show binding components without any side effect (e.g. promise).
#' * "environment" to show binding components without any side effects (e.g. promises or active bindings).

"] ",
"<",
crayon::cyan(type),
length,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking, but no length in the placeholder branch either?

Comment on lines +55 to +56
case R_ENV_BINDING_TYPE_forced:
out.push_back(obj_addr_(r_env_binding_forced_value(x, sym)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense, but you've somewhat arbitrarily decided to pick the value over the expr for forced promises right?

case EXTPTRSXP: return "EXTPTRSXP";
case WEAKREFSXP: return "WEAKREFSXP";
case RAWSXP: return "RAWSXP";
case S4SXP: return "S4SXP";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm uncertain of whether we should call this S4SXP or the newer OBJSXP which was added for R7
https://github.com/wch/r-source/blob/e996f331169fa4b255dd720e6778fe937230f0a2/src/include/Rinternals.h#L137-L138

Comment on lines +34 to +36
forced [14] <PROMSXP>
_value [14] <REALSXP[1]> ()
_code [15] <LANGSXP> ()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do 14 and 15 mean? Is this right? Are all 3 supposed to be 14?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants