Skip to content

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

Description

@jaganmn

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.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions