News for hackers. Stuff that matters.
Re:The Next Step for Generics by cousin_it on Wednesday June 17, 2020 @03:10AM (#23548659)
That insight is wrong. Not just superficially; it goes against the whole point of types.

1) Consider easing functions in animation (see easings.net for examples). They all have domain and range "real numbers between 0 and 1", yet they are all meaningfully different.

2) Consider filters in audio processing. They all have domain and range "streams of real numbers", yet they are all meaningfully different. The fact that they have the same type is important - it allows composition of filters, which I'd hope would sound exciting to a typed programmer!

3) Consider sorting algorithms. Even under a very advanced type system, the domain would be "arrays of numbers" and the range would be "sorted arrays of numbers". Yet there are tons of sorting algorithms that are meaningfully different. The fact that they have the same type is important - it allows a sorting library to evolve without breaking applications.

See the common thread? Types enable mixing and matching functionality. If a type allows only one functionality, it's useless for that purpose.

Re:The Next Step for Generics by MaxBarraclough on Wednesday June 17, 2020 @11:35AM (#23552663)
> They all have domain and range "real numbers between 0 and 1", yet they are all meaningfully different.

I was thinking a similar thought: sine vs cosine. But I think that falls under 'superficially wrong'.

Re:The Next Step for Generics by ummonk on Wednesday June 17, 2020 @03:18AM (#23548716)
I think the "only types matter" applies when you're simply applying natural transformations between isomorphic types.