Live data from Hacker News

Faster Sorting with Go Generics

eli.thegreenplace.net

61–62 of 62 posts

Re: Faster Sorting with Go Generics

#61
post #59
post #41

Earlier quoted context omitted.

Yours is a beautiful example of how to shoot yourself in the foot with reckless generalization. Addition of integers is commutative; concatenation of strings is not. That's not "a common idea". Compilers can transform a+b into b+a for one, if it suits them, but not for the other.

Just a nit, for floats it is not commutative either, not sure how much freedom do compilers have here. E.g. try summing many floats in decreasing value - chances are that adding a very small number in the end will not even change the value.

A nit's nit, float addition is commutative. It is not associative.
Post reply on HN