No, you are right but then I have made an explicit decision that state is
important and mutable so hopefully I would take that into consideration
when exposing the data.
lör 21 okt. 2017 kl 13:00 skrev Juliusz Chroboczek :
> > I have started to use non pointer slices much more as of late.
> > Eve
If I need to mutate elements of an array of by-value structs, I'll
usually do this: https://play.golang.org/p/YUFsOkvKQ4
Then for most of the body of the loop, you can use i and t as if you'd
ranged over pointers
to elements of the slice (no need to explicitly assign to the element).
On 20 Octob
https://play.golang.org/p/xILWETuAii
I have started to use non pointer slices much more as of late.
Every time I bother measuring it is always faster and it is better for the
GC (usually, caveats apply).
It also, perhaps naively, feels safer... :)
fre 20 okt. 2017 kl 13:41 skrev Juliusz Chrobocz