4 ms·
In 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++ m
by detrino 13y ago
In 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).