This describes pretty clearly what happens behind the scenes. Still, someone could wonder why append then does not receive a pointer to the slice, to ensure that both the slice header and the slice data are treated in a consistent way.
What is the generally accepted answer to this? For example, * In/out parameters are bad coding style * append shall have a function signature similar to other standard functions, for example, fmt.Sprintf (that also returns its result, rather than updating a pointer parameter) * or some technical reason On Monday, November 6, 2017 at 3:24:55 AM UTC+1, Dave Cheney wrote: > > I think #1 would be clearer if it were written as > > 1) "We must return the slice afterwards because ... the our slice value > (the run-time data structure holding the pointer, length, and capacity) is > a copy of the callers.” -- 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.