On Jan 2, 2014, at 1:54 PM, Filip Pizlo <fpi...@apple.com> wrote:

> 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:
> 
>     auto newSize = optimalSize();
> 
> or this:
> 
>     CGSize newSize = optimalSize();

I’m not sure that having the temporary created 200 lines before it was used 
would be improved with either of these cases! ;-)

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?

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.

-Brent


_______________________________________________
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev

Reply via email to