I think that this article is one of many great examples of arguments in favor
of less explicit typing. These lines of reasoning are often used by proponents
of both dynamic languages (like Ruby) and type-inferred languages (like ML or
Haskell). C++'s auto is almost exactly like what ML and Haskell have and it's
not surprising to me to see bloggers rehash these decades-old arguments.
But what I like about how we use C++ in WebKit is that we avoid writing English
comments, and try to document our code using types, function names, and
variable names. Types are a particularly powerful form of documentation
because it is checked by the compiler. I think that the main source of my
distaste for using auto everywhere is that it takes away our compiler-checked
documentation.
The article seems to suggest that we should say:
auto x = type { expression };
when we want documentation. But this is more noisy than saying:
type x = expression;
I don't think that the auto-based type expression suggested by the article has
any merits over the traditional variable type.
-Filip
On Jan 2, 2014, at 2:31 PM, Brent Fulgham <[email protected]> wrote:
> Hi Adam,
>
> On Jan 2, 2014, at 2:08 PM, Adam Roben <[email protected]> wrote:
>
>> I found
>> http://herbsutter.com/2013/08/12/gotw-94-solution-aaa-style-almost-always-auto/
>> very persuasive in my thinking about when to use auto.
>
> I think this does a much better job of explaining the benefits of ‘auto’ than
> I was able to come up with.
>
> -Brent
>
> _______________________________________________
> webkit-dev mailing list
> [email protected]
> https://lists.webkit.org/mailman/listinfo/webkit-dev
_______________________________________________
webkit-dev mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-dev