3 ms·
> No dammit, javascript does not coerce numbers to strings when comparing them, a "weak typing" implementation would behave exactly as he wants. Please note th
by weland 13y ago
> No dammit, javascript does not coerce numbers to strings when comparing them, a "weak typing" implementation would behave exactly as he wants.
Please note that I wrote it's a broken implementation over weak typing, not of weak typing. The typing system is fine, at least as far as this matter is concerned, but the standard library is badly applied over it.
- masklinn 13y ago> Please note that I wrote it's a broken implementation over weak typing, not of weak typing. But weak typing is a complete red herring, as I noted previously the behaviour of the default sort function is independent from the typing system, you could have a default sort function doing more or less the same thing in a very strict statically typed system. Haskell's `sort` is defined (more or less) as sort :: Ord a => [a] -> [a] sort = sortBy compare it could be (uselessly) defined as sort :: Show a => [a] -> [a] sort = sortBy (comparing show) resulting in the same behaviour you see in javascript.
- weland 13y agoYes, of course it is a red herring! OP's rage was against the JS community taking it as an excuse for shity implementation, that's all I was trying to clarify...