logoalt Hacker News

thunderseetheyesterday at 2:32 PM1 replyview on HN

> You can get localised unification but bidir as a whole like in Rust but you lose most of the advantage of unification.

Could you expand on this? I do not follow. You can create a bidir system that never requires annotations and uses unification to infer all types in the style of Haskell or OCaml. It is not often done because people are coming around to the idea that global type inference causes spooky action at a distance, but nothing prevents it from working.

> I maintain that what the article calls HM is trully unification

In some sense I think HM == unification because you can't really implement HM without unification. The first time a type variable encounters another type you'd be stuck.


Replies

StopDisinfo910yesterday at 2:57 PM

> You can create a bidir system that never requires annotations and uses unification to infer all types in the style of Haskell or OCaml.

There is no more bidir if you do that. It's just plain unification.

> In some sense I think HM == unification because you can't really implement HM without unification. The first time a type variable encounters another type you'd be stuck.

You can't implement HM without unification but you can do unification which is not HM. Actually a lot of what people call HM is not really HM but evolution of it and sometimes significant evolution.

show 1 reply