Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid early materialization of ALTREP objects #4210

Merged
merged 2 commits into from Jan 23, 2019

Conversation

@jmcphers
Copy link
Member

commented Jan 23, 2019

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 added some commits Jan 23, 2019

@jmcphers jmcphers requested a review from kevinushey Jan 23, 2019

@kevinushey

This comment has been minimized.

Copy link
Contributor

commented Jan 23, 2019

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; }

This comment has been minimized.

Copy link
@kevinushey

kevinushey Jan 23, 2019

Contributor

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

This comment has been minimized.

Copy link
@jmcphers

jmcphers Jan 23, 2019

Author Member

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

@jmcphers

This comment has been minimized.

Copy link
Member Author

commented Jan 23, 2019

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

This comment has been minimized.

Copy link
Contributor

commented Jan 23, 2019

Gotcha. I think that's fine.

@jmcphers jmcphers merged commit 2cb57d8 into master Jan 23, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.