<br><br><div class="gmail_quote">2009/3/23 Brandon S. Allbery KF8NH <span dir="ltr">&lt;<a href="mailto:allbery@ece.cmu.edu">allbery@ece.cmu.edu</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On 2009 Mar 24, at 0:21, Michael Mossey wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I&#39;m a beginner just learning about type inference (through getting lots of error messages and using :t a lot). I find it fascinating, and it seems a shame to disregard this power by declaring all types. However I realize that it&#39;s the more global or critical types that should be declared, and more local areas can be left to inference. Perhaps also the compiler&#39;s ability to infer is related to its ability to detect compile-time type errors. In other words, if you program a compiler to be sensitive enough to detect all type errors at compile time, then by necessity you are giving it the smarts to infer types. Is that right?<br>

</blockquote>
<br>
<br></div>
It may have the knowledge but not the mechanism (consider C++).<br><font color="#888888">
</font></blockquote></div><br>I guess now would be a bad time to mention that C++0x has type inference :D  Off topic, but couldn&#39;t resist.  Anyway, back to the original topic (kind of), would you consider it bad advice to omit type annotations in languages like ML or F# as well?  I can identify with both arguments, and I just wonder why one group of people would recommend omitting them, and another would recommend supplying them, with the only difference being the language.  I know in something like F# you have a fairly advanced IDE, so you can simply hover the mouse over a function name and get its inferred type signature.  I know you mentioned the performance penalty associated with a type being &quot;too generic&quot;, in the sense that typeclass lookups will constantly have to be done at runtime if something is too generic.  Perhaps the fact that these other languages don&#39;t support typeclasses and hence don&#39;t have the same performance penalty is part of the reason why it&#39;s ok (or at the very least, not as bad) to do this in these languages as it is in Haskell?<br>
<br>I&#39;m mostly just trying to understand why it&#39;s good in one language, and bad in another.  I&#39;m sure there must be a number of tangible advantages in each language, that either don&#39;t apply or are mapped to disadvantages in the other.  <br>