On Sun, Nov 5, 2017 at 3:16 AM Ben Hoyt <benh...@gmail.com> wrote:

> Hence the confusion. Sure, append can write to the underlying array
because that's effectively passed by reference. But it can't update the
length of the slice itself, unless you return it.

I don't follow. It had been shown, that the result of append is actually
not needed/can be constructed by other means - except in the case where the
backing array gets reallocated. Then you can't get away without it.

BTW, I recommend to not think in terms of references. The Go language
specification does not mention nor define that term and there's not just a
single meaning of "reference". Also, references are commonly regarded not
the same thing as pointers.

-- 

-j

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to