<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Jan 2, 2014, at 1:54 PM, Filip Pizlo <<a href="mailto:fpizlo@apple.com">fpizlo@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="auto">I think the goal should be that if you do introduce a temporary variable for some reason, then being explicit about its type is better. Consider that in your second example, there might be 200 lines of code between the call to optimalSize() and the call to setSize(). I that case, we're essentially choosing between having the code reader see this:</div><div dir="auto"><br></div><div dir="auto"> auto newSize = optimalSize();</div><div dir="auto"><br></div><div dir="auto">or this:</div><div dir="auto"><br></div><div dir="auto"> CGSize newSize = optimalSize();</div></div></blockquote><div><br></div><div>I’m not sure that having the temporary created 200 lines before it was used would be improved with either of these cases! ;-)</div><div><br></div><div>Allowing the compiler to infer type seems like a big win, for all the same reasons it is for SML and other Hindley-Milner languages. Why must I manually enter stuff that the compiler should be able to determine for me?</div><div><br></div><div>Our development environments should be capable of showing us the resulting ‘auto’ type, so I feel like requiring explicit type declarations are a step backwards.</div><div><br></div><div>-Brent</div><div><br></div><div><br></div></div></body></html>