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

Mutation of "iter" objects bound in global environment in RStudio #3

Open
jaganmn opened this issue Dec 6, 2021 · 0 comments
Open

Comments

@jaganmn
Copy link

jaganmn commented Dec 6, 2021

By default, RStudio silently runs str(x) whenever you assign a value to the name x in the global environment, in order to populate the Environment pane. As a result,

library("iterators")
x <- iter(1:3)
x$state$i

returns 4L instead of 0L. (str.default evaluates vapply(x, typeof, "") and vapply evaluates as.list.iter(x).) The issue would be resolved if you wrote your own method for str avoiding as.list.iter, or if you moved the functionality of as.list.iter into a different function altogether so that str.default uses as.list.default.

This issue was brought to my attention by a question on Stack Overflow, here.

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

No branches or pull requests

1 participant