[webkit-dev] When to use "auto"? (I usually consider it harmful)
bfulgham at gmail.com
Sat Jan 4 13:10:30 PST 2014
> On Jan 4, 2014, at 12:01 PM, Alex Christensen <alex.christensen at flexsim.com> wrote:
> [...] but I like to err on the more explicit side of coding. It is hard to say "does this make the code cleaner more than it removes useful information?" or "will this cause problems for other developers?" with a style guideline.
The problem is that those declarations aren't really doing what you think they are; we are simply engaging in 'type theater'.
The annotations indicate what the author thought the resulting type of the RHS expression would be, or perhaps were at one time. But they are only showing what we are asking the compiler to coerce the result into. I would argue that the number of times we really want to coerce the result of an expression to something new are relatively rare, and could be handled be the new 'type' syntax, or explicit cast declarations.
More information about the webkit-dev