On Dec 4, 2010, at 3:01 PM, Maciej Stachowiak wrote:
Passing a true or false literal (at least in cases where it's not the sole
argument) is a likely indicator of unclear style, as opposed to taking a
boolean argument.
Agreed.
In fact, even putting a boolean literal in a named variable
On Dec 6, 2010, at 10:15 AM, Darin Adler wrote:
On Dec 4, 2010, at 3:01 PM, Maciej Stachowiak wrote:
Passing a true or false literal (at least in cases where it's not the sole
argument) is a likely indicator of unclear style, as opposed to taking a
boolean argument.
Agreed.
In
On Dec 3, 2010, at 2:08 PM, Alexey Proskuryakov wrote:
03.12.2010, в 13:54, Eric Seidel написал(а):
I'm not sure we have any examples of bool passing like that in real code.
We do, although I can't provide one now. I just remember this being discussed
in bug review.
I think that
It seems to me, that using bool types for function arguments is strictly
worse than using an enum. An enum is always clearer and can be easily
casted to a bool if needed.
doSomething(something, false);
Is much less readable than:
doSomething(something, AllowNetworkLoads);
Do any C++ gurus
On Fri, Dec 3, 2010 at 1:28 PM, Eric Seidel e...@webkit.org wrote:
It seems to me, that using bool types for function arguments is strictly
worse than using an enum. An enum is always clearer and can be easily
casted to a bool if needed.
doSomething(something, false);
Is much less
On Fri, Dec 3, 2010 at 1:28 PM, Eric Seidel e...@webkit.org wrote:
It seems to me, that using bool types for function arguments is strictly
worse than using an enum. An enum is always clearer and can be easily
casted to a bool if needed.
doSomething(something, false);
Is much less
On Dec 3, 2010, at 3:33 PM, Darin Fisher wrote:
On Fri, Dec 3, 2010 at 1:28 PM, Eric Seidel e...@webkit.org wrote:
It seems to me, that using bool types for function arguments is strictly
worse than using an enum. An enum is always clearer and can be easily casted
to a bool if needed.
Dave, I'm not sure I understand your exception. Could you give an example?
On Fri, Dec 3, 2010 at 1:37 PM, David Hyatt hy...@apple.com wrote:
On Dec 3, 2010, at 3:33 PM, Darin Fisher wrote:
On Fri, Dec 3, 2010 at 1:28 PM, Eric Seidel e...@webkit.org wrote:
It seems to me, that using bool
That would be so unbelievably fantastic!
On Fri, Dec 3, 2010 at 1:35 PM, David Levin le...@google.com wrote:
On Fri, Dec 3, 2010 at 1:28 PM, Eric Seidel e...@webkit.org wrote:
It seems to me, that using bool types for function arguments is strictly
worse than using an enum. An enum is
On Fri, Dec 3, 2010 at 1:37 PM, David Hyatt hy...@apple.com wrote:
The only exception I would make to this rule is if all the call sites use
variables and never pass in raw true or false. In that case there's no loss
of readability, and whether you use an enum vs. a bool is irrelevant.
I
I'm not sure we have any examples of bool passing like that in real code.
The case I'm concerned about is not one of single argument bools:
doSoemthing(bool)
but more of multi-argument functions:
doSomething(something, bool)
I'm trying to write a rule which can be easily automated by
On Fri, Dec 3, 2010 at 1:45 PM, Ryosuke Niwa rn...@webkit.org wrote:
On Fri, Dec 3, 2010 at 1:37 PM, David Hyatt hy...@apple.com wrote:
The only exception I would make to this rule is if all the call sites use
variables and never pass in raw true or false. In that case there's no loss
of
I do not think that XXX:repaint(true /* immediate */) is so bad
either, if I understood Hyatt's comment correctly, and I agree with him on it.
Having a enum is ideal, but no need for it to be mandatory, as other
also pointed out.
On Fri, Dec 3, 2010 at 4:54 PM, Eric Seidel e...@webkit.org wrote:
I think /* explanation of what I'm doing */ is strictly worse than
readableCode(UnderstandableParameter).
I'd rather have readable code than comments attempting to excuse unreadable
code.
-eric
On Fri, Dec 3, 2010 at 1:57 PM, Antonio Gomes toniki...@gmail.com wrote:
I do not think that
Again, I think enum is better. I am just saying that method(true /*
xxx */) is not as bad as method(true, true, true, false);
On Fri, Dec 3, 2010 at 5:01 PM, Eric Seidel e...@webkit.org wrote:
I think /* explanation of what I'm doing */ is strictly worse than
03.12.2010, в 13:54, Eric Seidel написал(а):
I'm not sure we have any examples of bool passing like that in real code.
We do, although I can't provide one now. I just remember this being discussed
in bug review.
I think that Dave's rule is best here, even if it meant that we couldn't check
On Fri, Dec 3, 2010 at 1:55 PM, Nico Weber tha...@chromium.org wrote:
Out of curiosity, what do people think of
doSomethingElse(/*paramName=*/true);
when calling an existing function that takes a bool?
Why don't we just change it to take enum instead? Adding a comment to
repeat the
On Fri, Dec 3, 2010 at 2:08 PM, Alexey Proskuryakov a...@webkit.org wrote:
I think that Dave's rule is best here
I second that.
- Ryosuke
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
On Dec 3, 2010, at 1:37 PM, David Hyatt wrote:
The only exception I would make to this rule is if all the call sites use
variables and never pass in raw true or false. In that case there's no loss
of readability, and whether you use an enum vs. a bool is irrelevant.
That’s right. There are
An example of nice boolean usage is:
paintTextWithShadows(context, font, textRun, 0, length, length, textOrigin,
boxRect, textShadow, textStrokeWidth 0, isHorizontal()); GOOD!
The last parameter is a boolean indicating whether or not the text run is
vertical text or horizontal text. It would
On Fri, Dec 3, 2010 at 2:42 PM, David Hyatt hy...@apple.com wrote:
An example of nice boolean usage is:
paintTextWithShadows(context, font, textRun, 0, length, length,
textOrigin, boxRect, textShadow, textStrokeWidth 0, isHorizontal());
GOOD!
The last parameter is a boolean indicating
21 matches
Mail list logo