Re:a[low:high:max] in Golang – A Rare Slice Trick
by andrewstuart2 on Saturday March 18, 2023 @01:47PM
(#35211385)
That's just not true. There are immutable arrays in length. [4]int cannot be appended to. The backing of all slices are array types and array doubling is used for appends that go beyond the capacity.
Re:a[low:high:max] in Golang – A Rare Slice Trick
by tedunangst on Saturday March 18, 2023 @02:29PM
(#35211770)
Yeah, that was a mistake.
Re:a[low:high:max] in Golang – A Rare Slice Trick
by yencabulator on Sunday March 19, 2023 @10:06PM
(#35226378)
No array can change its length, the length is part of the type. There really are no "immutable array"s.
The backing store for a slice is just a pointer. The rule is you don't give people pointers that you don't want them to write to.