Hi folks.
Recently, I’ve seen patches go by using the C++11 “auto” keyword. For example,
let me pick on Andreas:
http://trac.webkit.org/changeset/161143
+auto newRenderer = textNode.createTextRenderer(style);
+ASSERT(newRenderer);
….
+
On Jan 2, 2014, at 1:12 PM, Geoffrey Garen gga...@apple.com wrote:
Hi folks.
Recently, I’ve seen patches go by using the C++11 “auto” keyword. For
example, let me pick on Andreas:
http://trac.webkit.org/changeset/161143
+auto newRenderer = textNode.createTextRenderer(style);
+
On Jan 2, 2014, at 1:12 PM, Geoffrey Garen gga...@apple.com wrote:
Hi folks.
Recently, I’ve seen patches go by using the C++11 “auto” keyword. For
example, let me pick on Andreas:
http://trac.webkit.org/changeset/161143
+auto newRenderer = textNode.createTextRenderer(style);
+
02 янв. 2014 г., в 13:12, Geoffrey Garen gga...@apple.com написал(а):
I think an appropriate style guideline for “auto” would say something like:
- Use “auto to declare a disgusting templated iterator type in a loop
- Use “auto… - to define a template-dependent return type in a class
On Thu, 2014-01-02 at 13:12 -0800, Geoffrey Garen wrote:
I think an appropriate style guideline for “auto” would say something like:
- Use “auto to declare a disgusting templated iterator type in a loop
- Use “auto… - to define a template-dependent return type in a class
template
- In
On Jan 2, 2014, at 1:40 PM, Dan Bernstein m...@apple.com wrote:
On Jan 2, 2014, at 1:12 PM, Geoffrey Garen gga...@apple.com wrote:
Hi folks.
Recently, I’ve seen patches go by using the C++11 “auto” keyword. For
example, let me pick on Andreas:
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
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.
-Adam
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
On Jan 2, 2014, at 1:59 PM, Brent Fulgham bfulg...@apple.com wrote:
Hi,
On Jan 2, 2014, at 1:12 PM, Geoffrey Garen gga...@apple.com wrote:
+auto newRenderer = textNode.createTextRenderer(style);
+ASSERT(newRenderer);
….
+parentRenderer-addChild(newRenderer.leakPtr(),
I think this use of “auto” is net harmful.
I disagree. I think the use of auto is an improvement, because it makes it
less likely that we have something like the following:
int wrong = something.get64BitInt(); // potential truncation
This argument is a red herring for two reasons:
(1)
We tend to avoid local write-once-read-once local variables, i.e. we tend to
prefer
{
setSize(optimalSize());
}
to
{
CGSize newSize = optimalSize();
setSize(newSize);
}
But the up- and down-sides of this are the same as those of using auto.
I think I basically agree
What do you think about these examples?
auto failureCallback = [promiseWrapper]() mutable {
promiseWrapper.reject(nullptr);
};
Here I think auto is good because the type is disgusting to write out by hand,
and because the type is clearly visible on the right hand side of
Hi Adam,
On Jan 2, 2014, at 2:08 PM, Adam Roben aro...@webkit.org 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’
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
Hi Filip,
Coming back to your earlier example:
auto newSize = optimalSize();
vs:
CGSize newSize = optimalSize();
If I understand your argument, you feel that the explicit CGSize declaration
helps the reader because it makes the return value of optimalSize() explicit.
However, that
One interesting point in this article, which I tend to agree with, is that it
seems generally appropriate to use “auto” in any line of code that already
conveys type. For example:
(1) Lambda, as pointed out by Alexey:
auto failureCallback = [promiseWrapper]() mutable {
On Jan 2, 2014, at 2:55 PM, Brent Fulgham bfulg...@apple.com wrote:
Hi Filip,
Coming back to your earlier example:
auto newSize = optimalSize();
vs:
CGSize newSize = optimalSize();
If I understand your argument, you feel that the explicit CGSize declaration
helps the reader
On Thu, Jan 02, 2014 at 01:12:46PM -0800, Geoffrey Garen wrote:
Hi folks.
Recently, I’ve seen patches go by using the C++11 “auto” keyword. For
example, let me pick on Andreas:
http://trac.webkit.org/changeset/161143
+auto newRenderer = textNode.createTextRenderer(style);
+
On Thu, Jan 2, 2014 at 4:12 PM, Geoffrey Garen gga...@apple.com wrote:
I think an appropriate style guideline for “auto” would say something like:
- Use “auto to declare a disgusting templated iterator type in a loop
- Use “auto… - to define a template-dependent return type in a class
On Jan 2, 2014, at 2:48 PM, Filip Pizlo fpi...@apple.com wrote:
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
20 matches
Mail list logo