Stream: contributing

Topic: Opportunistic mutation bug


view this post on Zulip Fletch Canny (Dec 14 2023 at 01:57):

I found https://github.com/roc-lang/roc/issues/6139 and it appears as though this issue may have the same cause as one I have experienced.

However, this issue seems to be only for Strs and I was able to replicate a minimal example using Lists, so I was wondering if it would be worth creating another GitHub issue with the following example

app "reference count bug"
    packages {
        pf: "https://github.com/roc-lang/basic-cli/releases/download/0.5.0/Cufzl36_SnJ4QbOoEmiJ5dIpUxBvdB3NEySvuH82Wio.tar.br",
    }
    imports [ pf.Task ]
    provides [main] to pf

main = Task.ok {}

expect
  in == f in

in = [A, B]

f = \x ->
  _ = x |> List.reverse
  x

The expectation fails because in == [B, A]. I would figure that top level declarations would never be mutated, but I'm not sure.

The bug won't happen if you

view this post on Zulip Brendan Hansknecht (Dec 14 2023 at 02:42):

That would be a nice minimal reproducer, would be great to file an issue


Last updated: Jul 05 2025 at 12:14 UTC