Skip to content

Conversation

@jmcphers
Copy link
Member

Currently, ALTREP objects (new in R 3.5.0) are fully materialized by RStudio's environment pane, since it calls object.size() on them. This change protects these objects from premature evaluation by avoiding the environment pane's size/length inspection on objects with the alt flag set (indicating an ALTREP).

Note that this does not protect the objects from any type of materialization at all; the first few elements will still be materialized by str(), which we continue to call.

Fixes #4171.

@jmcphers jmcphers requested a review from kevinushey January 23, 2019 23:10
@kevinushey
Copy link
Contributor

LGTM!

Do we need any UI-side changes so that the Environment pane reports something reasonable for these objects (when in Grid view)?

}
public:
bool empty() const { return versionMajor_ != 0; }
bool empty() const { return versionMajor_ == 0; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Yikes! I guess we weren't ever really exercising this code path before?

Copy link
Member Author

Choose a reason for hiding this comment

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

We were not! As far as I can tell this method was never used before.

@jmcphers
Copy link
Member Author

Do we need any UI-side changes so that the Environment pane reports something reasonable for these objects (when in Grid view)?

We just report them as having no size -- the same thing we do for other "don't touch" objects (active bindings, uneval'ed promises, etc.)

@kevinushey
Copy link
Contributor

Gotcha. I think that's fine.

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.

3 participants