4 ms·
I thought the special pass given to append, make, and delete depends on the special nature of slices and maps. That is, a []Whatever is not as opaque as a What
by biztos 10y ago
I thought the special pass given to append, make, and delete depends on the special nature of slices and maps.
That is, a []Whatever is not as opaque as a Whatever{} or an interface{}. Same with a map[Foo]Bar, you (you being Go) know it's a map.
(I have no opinion on whether Go should have generics, I just think the apparent exceptions make sense even if they might seem unfair.)
- camus2 10y agoYour argument doesn't explain why a programmer cannot implement his own append or delete functions on existing container types. These exceptions do not make sense.