News for hackers. Stuff that matters.
Re:Why I Don't Like Golang (2016) by marcosdumay on Wednesday June 12, 2019 @08:53PM (#20170914)
> append() doesn't operate on arrays, it operates on slices

If you go with most languages definition of "slice", that would be pretty horrible just by itself.

But, as you said, Go's definition is different (what is also bad, just not much):

> Slices are backed by arrays, and if you append to a slice whose backing array is full, it will "grow" by allocating a bigger array elsewhere and copying the original data into it

What would be pretty much like Java's ArrayList, or Python's list if it was designed on a sane way. So, just the name would be non-standard... But the container actually migrates when it is reallocated! That's a broken design in any language.

Re:Why I Don't Like Golang (2016) by weberc2 on Wednesday June 12, 2019 @09:29PM (#20171101)
> If you go with most languages definition of "slice", that would be pretty horrible just by itself.

Most languages don't have a definition of "slice" at all.

> What would be pretty much like Java's ArrayList, or Python's list if it was designed on a sane way. So, just the name would be non-standard... But the container actually migrates when it is reallocated! That's a broken design in any language.

It's not broken, it's just fast and simple. But yes, it does require you to know that Go's slices are not exactly Python's lists (which do gratuitous copies). Java's implementation does an insert on the original list (both surprising and an unnecessary copy).