Container of mutable structs without 100x slowdown?

Yes, Accessors.jl is actually the successor of SetField.jl (but the latter is still maintained).

(I’m not a very proficient user of SetField / Accessors, so take the following with a grain of salt)

Accessors.jl also provides the nice syntax @set s.x = 1, but I don’t think it works when s is replaced by something like a[i].

In other words, I think @set a[i].s = 1 is interpreted as : “give me a copy of a in which the x field of the i-th element is set to 1”. As opposed to “give me a copy of a[i] in which the x field is set to 1” (which would be the desired semantics here).

2 Likes