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

Mutable collection usage #24

Open
jetjager opened this issue Dec 22, 2022 · 1 comment
Open

Mutable collection usage #24

jetjager opened this issue Dec 22, 2022 · 1 comment

Comments

@jetjager
Copy link

The following code triggers a 'Detected the use of a mutable collection inside a defer clause.', but I don't think it should lead to any issues.

defer {
    val text = ZIO.succeed("1,2,3").run
    val values = text.split(",").toList
    ZIO.foreach(values)(v => zio.Console.printLine(v))
  }
@deusaquilus
Copy link
Contributor

The text.split(",") call returns a Java array I.e mutable. I’m thinking that maybe I should relax the rules for Array because there is only one real mutation operator on it (I.e set-at-index) which I could check for.

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

2 participants