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

> That’s common to all typed languages

It isn't. Haskell, for example, has a type system expressive enough to encode concepts such as "a function which takes an array of elements of any type (fixed at compile time) and another function which operates on elements of the type that array is composed of and returns an array of elements of that unnamed type" and it has a type system with fewer holes than any Algol-derived language's (Ada, C, Pascal) type system has.



You should literally continue reading the rest of the sentence.


Haskell doesn't have generics or templates, it has an expressive type system.


"Expressive Type System" without context is just a buzzword. In this particular context, it simply means that Haskell allows for types to be parameterised, which is a different way of saying it allows for generic types.


Algol 60’s type system has fewer holes than most Algol-derived languages.


> Algol 60’s type system has fewer holes than most Algol-derived languages.

And this can be a mixed blessing. If an inexpressive type system has few or no holes, it becomes a straitjacket where you can't write the kinds of perfectly well-defined functions you need because the type system can't express them. The classic pathological example is how Standard Pascal couldn't express the concept of a function which took an arbitrary-size array, but the example so common it's typically overlooked is how it's impossible in many Algol-derived languages to write one function to compare two numbers instead of having to write four or five such functions, especially if you're unwilling to let the type system hole of automatic integral and floating-point size promotion potentially introduce odd bugs.

Haskell's type system is strong and fairly expressive, with language extensions to make it more expressive.

(This does not change the fact type systems typically express the wrong things, but this post is long enough already.)




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: