Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Compare general comparison sorts with counting sorts for a simple example. The latter require additional properties on the value making them much less general, but you gain major performance benefits.

In theory sure, but I've never seen anyone use a counting sort in production code.

> You have to verify all required properties anyway or you end up in a similar place.

You go from n * m to n + m though, and since the properties are often simple and standard they might be done for you in the standard library already.

> Generic does not mean general, but programming languages do not have an easy way to verify properties so you end up with general.

Typeclasses give a reasonable representation; newer languages let you require their properties to be verified if you really want.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: