| |
| | Type Inference |
 | | The most common type of type inference is called HindleyMilnerTypeInference and is found in various forms in MlLanguage and HaskellLanguage. |
 | | ...firstly because the type of x and y aren't defined at their first use (first sign that type inference isn't supported), but even beyond that, because when add() is instantiated, it doesn't know what types x and y are, and cannot cope with that. |
 | | A similar language with actual type inference might see that x and y are double, since they are used that way after the template instantiation, and given that knowledge, work backwards to see that add() should be specialized on (double, double). |
| c2.com /cgi/wiki?TypeInference (2013 words) |
|