3 ms·
> 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.
by weberc2 7y ago
> 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).