News for hackers. Stuff that matters.
Re:Why I Don't Like Golang (2016) by masklinn on Thursday June 13, 2019 @02:16AM (#20172247)
> This is a pretty standard data structure in most languages.

Vectors are standard data structures.

Append possibly mutating in place and possibly return a new vector instead, not so much.

That's exactly what Go does.

Not to mention the ability to share a backing array between two "vectors" and to append to both. That's a Go innovation right there.

Re:Why I Don't Like Golang (2016) by candiodari on Thursday June 13, 2019 @06:41AM (#20173438)
> Not to mention the ability to share a backing array between two "vectors" and to append to both. That's a Go innovation right there.

It's been pointed out in the comment right below this, but it is a bug if you do this. If the backing array has any free capacity the results will be very different from what you expect.