Thomas Hallgren:
> The monomorphism restriction makes sure that certain values are computed at
most
> once by restricting them to be used at only one type. Couldn't the same be
> achieved by
>
> * getting rid the monomorphism restriction, i.e., let all definitions to be
> overloaded by default,
> * add the language implementation requirement that overloaded values should
be
> computed at most once for each instance they are used at.
I think this is definitely feasible, but I wonder if it's entirely
prudent. Could definitely lead to a quantity of code-bloat. One
of the annoyances of the MR is that it _disallows_ this as a solution,
even if the compiler were in a position to determine that it was
pragmatically sensible. I can imagine cases where this remedy is
either basically unnecessary (little shared work inside the unapplied
CAF), or worse than the disease (blowup in the number of instances),
so it seems excessive to require it, either.
Slan libh,
Alex.