3 ms·
Yep, and also overloading, overall HM just isn't a good choice for a programming language.
by detrino 13y ago
Yep, and also overloading, overall HM just isn't a good choice for a programming language.
- codygman 13y agoCare to list the reasons why you believe HM just isn't a good choice for a programming language?
- detrino 13y agoIt limits the type system in order to achieve global type inference. HM is often touted as a "sweet spot" in static type systems because you don't have to specify types anywhere, but in reality it tends to be more verbose and less powerful than local type inference.
- codygman 13y agoThat hasn't been my experience, could you show me a small example?
- deleted 13y ago[deleted]
- detrino 13y agoIn an HM system there is no overloading so you are essentially naming type constraints on every function call instead of once in the function definition. C++ might look like this: void do_something(bar_t & bar) { ... bar.foo(...); bar.baz(...); auto something = bar.get_something(); ... } The equivalent Ocaml might look like this: let do_something bar = ... Bar.foo bar ...; Bar.baz bar ...; let something = Bar.get_something bar in ... The situation is similar when dealing with structs and tends to be ever worse when dealing with generic code (although C++ only has duck typed generics until concepts comes along).