Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-16 Thread Jeff Gilbert
On Thu, Jul 16, 2015 at 6:50 AM, Ehsan Akhgari wrote: > On 2015-07-15 6:47 PM, Jeff Gilbert wrote: > >> "Arg warts improve backtracking for debugging" >> Regardless of the validity of "Arg warts help illustrate information >> flow", the use-case of backtracking to 'origin' of aFoo is also >> unc

Re: Switch to Google C++ Style Wholesale (was Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++)

2015-07-16 Thread R Kent James
On 7/14/2015 8:23 AM, Benjamin Smedberg wrote: > Aww, I was avoiding getting into this thread. > ... > The argument I am most sympathetic to is that this convention is a > barrier to new contributors. Making new contributors productive, both > employees and volunteers, is a very good reason to cho

Re: Switch to Google C++ Style Wholesale (was Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++)

2015-07-16 Thread Chris Pearce
On 7/15/2015 3:23 AM, Benjamin Smedberg wrote: Given that premise, we shouldn't just change aArgument; we should adopt the Google C++ style guide wholesale: * names_with_underscores * members_with_trailing_ * no more ns prefix I used this style in a personal project, and I quickly came to

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-16 Thread Ehsan Akhgari
On 2015-07-15 6:47 PM, Jeff Gilbert wrote: "Arg warts improve backtracking for debugging" Regardless of the validity of "Arg warts help illustrate information flow", the use-case of backtracking to 'origin' of aFoo is also unconvincing, since you'd only need to go back once more than previously

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-16 Thread WaltS48
On 07/16/2015 01:16 AM, Thomas Zimmermann wrote: Hi Am 16.07.2015 um 00:47 schrieb Jeff Gilbert: On Tue, Jul 14, 2015 at 7:55 AM, Thomas Zimmermann mailto:tzimmerm...@mozilla.com>> wrote: The discussion has a number of good points in favor of using 'a', but I missed convincing a

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-15 Thread Thomas Zimmermann
Hi Am 16.07.2015 um 00:47 schrieb Jeff Gilbert: > On Tue, Jul 14, 2015 at 7:55 AM, Thomas Zimmermann > mailto:tzimmerm...@mozilla.com>> wrote: > > The discussion has a number of good points in favor of using 'a', > but I > missed convincing arguments in favor of not using 'a'. Are ther

Re: Switch to Google C++ Style Wholesale (was Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++)

2015-07-15 Thread Benjamin Smedberg
On 7/15/2015 5:47 PM, Andrew Sutherland wrote: Would it be crazy for us to resort to a poll on these things? A poll will not be useful for informing this decision. --BDS ___ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mo

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-15 Thread smaug
On 07/16/2015 01:47 AM, Jeff Gilbert wrote: On Tue, Jul 14, 2015 at 7:55 AM, Thomas Zimmermann wrote: The discussion has a number of good points in favor of using 'a', but I missed convincing arguments in favor of not using 'a'. Are there any? I don't consider "I don't get what 'a' is good for

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-15 Thread Jeff Gilbert
On Tue, Jul 14, 2015 at 7:55 AM, Thomas Zimmermann wrote: > The discussion has a number of good points in favor of using 'a', but I > missed convincing arguments in favor of not using 'a'. Are there any? I > don't consider "I don't get what 'a' is good for" a convincing argument. > On the other

Re: Switch to Google C++ Style Wholesale (was Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++)

2015-07-15 Thread Andrew Sutherland
Would it be crazy for us to resort to a poll on these things? I propose abusing the mozillans.org "skills" field in profiles. For example, I have created the following sets of skills on mozillians.org by question, and which should autocomplete if you go to the edit page for your profile at https:

Re: Switch to Google C++ Style Wholesale (was Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++)

2015-07-15 Thread Bobby Holley
On Wed, Jul 15, 2015 at 2:26 PM, Gregory Szorc wrote: > The public source code for Firefox has existed for 17+ years (since ~April > 1998). We can only assume it will be around for another 10+ years. > > I believe you have to take the long view on the cost benefit analysis and > realize that a lo

Re: Switch to Google C++ Style Wholesale (was Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++)

2015-07-15 Thread Gregory Szorc
The public source code for Firefox has existed for 17+ years (since ~April 1998). We can only assume it will be around for another 10+ years. I believe you have to take the long view on the cost benefit analysis and realize that a lot of pain in the short term (e.g. switching styles entirely) will

Re: Switch to Google C++ Style Wholesale (was Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++)

2015-07-15 Thread Jeff Gilbert
On Tue, Jul 14, 2015 at 9:17 PM, Nicholas Nethercote wrote: > On Tue, Jul 14, 2015 at 8:06 PM, Bobby Holley > wrote: > > I'm not wild about this idea. > > It's such a boil-the-ocean solution I honestly thought bsmedberg was > joking at first... > Well consistency is a major concern, so as long

Re: Switch to Google C++ Style Wholesale (was Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++)

2015-07-14 Thread Nicholas Nethercote
On Tue, Jul 14, 2015 at 8:06 PM, Bobby Holley wrote: > I'm not wild about this idea. It's such a boil-the-ocean solution I honestly thought bsmedberg was joking at first... Nick ___ dev-platform mailing list dev-platform@lists.mozilla.org https://lists

Re: Switch to Google C++ Style Wholesale (was Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++)

2015-07-14 Thread Bobby Holley
I'm not wild about this idea. Switching styles entirely would be several times more churn and work than just making our existing codebase conform to our existing style guide. Consistency with Google's style might be a nice bonus, and there might be subjective arguments for one or the other, but non

Re: Switch to Google C++ Style Wholesale (was Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++)

2015-07-14 Thread Ehsan Akhgari
On 2015-07-14 6:53 PM, Birunthan Mohanathas wrote: On 14 July 2015 at 08:23, Benjamin Smedberg wrote: The argument I am most sympathetic to is that this convention is a barrier to new contributors. Making new contributors productive, both employees and volunteers, is a very good reason to choos

Re: Switch to Google C++ Style Wholesale (was Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++)

2015-07-14 Thread Birunthan Mohanathas
On 14 July 2015 at 08:23, Benjamin Smedberg wrote: > The argument I am most sympathetic to is that this convention is a barrier > to new contributors. Making new contributors productive, both employees and > volunteers, is a very good reason to choose one style over another. The C++ world is a hu

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-14 Thread Robert O'Callahan
On Wed, Jul 15, 2015 at 2:55 AM, Thomas Zimmermann wrote: > The discussion has a number of good points in favor of using 'a', but I > missed convincing arguments in favor of not using 'a'. Are there any? I > don't consider "I don't get what 'a' is good for" a convincing argument. > It increases

Re: Switch to Google C++ Style Wholesale (was Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++)

2015-07-14 Thread Robert O'Callahan
On Wed, Jul 15, 2015 at 3:40 AM, Joshua Cranmer 🐧 wrote: > The biggest problem here is that WebIDL and XPIDL codegen are heavily > geared towards camelCase names, as the IDL convention is camelCase. C++ names matching WebIDL (or spec names in general) has value. We've gotten quite close to that

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-14 Thread Karl Tomlinson
Tom Tromey writes: > It was mentioned elsewhere in this thread that some code assigns to > arguments. The style guide should clarify that parameters named aFoo should not be assigned to. Otherwise that defeats the purpose. Non-const references are the exception. If these are really needed, the

Re: Switch to Google C++ Style Wholesale (was Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++)

2015-07-14 Thread smaug
On 07/14/2015 08:11 PM, Martin Thomson wrote: On Tue, Jul 14, 2015 at 10:06 AM, Gregory Szorc wrote: That being said, every other organizations in the world is using the same or similar tools and is faced with similar challenges. Lack of a commit-skipping feature doesn't hinder other organizati

Re: Switch to Google C++ Style Wholesale (was Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++)

2015-07-14 Thread Kyle Huey
On Tue, Jul 14, 2015 at 8:23 AM, Benjamin Smedberg wrote: > > > On 7/8/2015 7:31 AM, Nathan Froyd wrote: > >> If somebody is willing to do the formatting, I'm willing to do the >> review. I think the thread has reached the point of people repeating ad >> nauseum what was already said earlier in t

Re: Switch to Google C++ Style Wholesale (was Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++)

2015-07-14 Thread Martin Thomson
On Tue, Jul 14, 2015 at 10:06 AM, Gregory Szorc wrote: > That being said, every other organizations in the world is using the same > or similar tools and is faced with similar challenges. Lack of a > commit-skipping feature doesn't hinder other organizations from performing > major refactorings. S

Re: Switch to Google C++ Style Wholesale (was Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++)

2015-07-14 Thread Gregory Szorc
On Tue, Jul 14, 2015 at 9:06 AM, David Major wrote: > May I request that the major parts of this not happen until we have a > blame that can "see through" such changes. > > Last I checked, gps had some ideas in that space but lacked time to > implement. > I spoke to a Mercurial maintainer about

Re: Switch to Google C++ Style Wholesale (was Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++)

2015-07-14 Thread Seth Fowler
> On Jul 14, 2015, at 8:23 AM, Benjamin Smedberg wrote: > > * no more ns prefix Are people still creating new classes with an ’ns’ prefix? Surely this is something we can drop right away, at least for new code. Much of the codebase already does not use this style. We have namespaces now, afte

Re: Switch to Google C++ Style Wholesale (was Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++)

2015-07-14 Thread David Major
May I request that the major parts of this not happen until we have a blame that can "see through" such changes. Last I checked, gps had some ideas in that space but lacked time to implement. On Wed, Jul 15, 2015, at 03:23 AM, Benjamin Smedberg wrote: > > > On 7/8/2015 7:31 AM, Nathan Froyd wro

Re: Switch to Google C++ Style Wholesale (was Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++)

2015-07-14 Thread Joshua Cranmer 🐧
On 7/14/2015 10:23 AM, Benjamin Smedberg wrote: Given that premise, we shouldn't just change aArgument; we should adopt the Google C++ style guide wholesale: * names_with_underscores The biggest problem here is that WebIDL and XPIDL codegen are heavily geared towards camelCase names, as the

Switch to Google C++ Style Wholesale (was Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++)

2015-07-14 Thread Benjamin Smedberg
On 7/8/2015 7:31 AM, Nathan Froyd wrote: If somebody is willing to do the formatting, I'm willing to do the review. I think the thread has reached the point of people repeating ad nauseum what was already said earlier in the thread, so it's time for a decision. Benjamin? Aww, I was avoiding

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-14 Thread Thomas Zimmermann
Hi Am 14.07.2015 um 16:19 schrieb Joshua Cranmer 🐧: > On 7/14/2015 1:39 AM, Thomas Zimmermann wrote: >> When writing code, I consider it good style to not write into >> anything that starts with an 'a' prefix, except result arguments. > > "You should never write into something with an 'a' prefix e

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-14 Thread L. David Baron
On Tuesday 2015-07-14 10:27 -0400, Kartikaya Gupta wrote: > Admittedly not perfect, but as a first-order approximation: > > kats@kgupta-air mozilla-git$ find . -name "*.cpp" | xargs grep "^ > *a[A-Z]\w* = " | wc -l > 5414 > > That's not a lot considering the size of the codebase. And a decen

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-14 Thread Kartikaya Gupta
(and 600+ plus of those are from my objdirs, actually). Here it is broken down by dir: kats@kgupta-air mozilla-git$ find . -type d -maxdepth 1 -mindepth 1 | grep -v ".git" | while read dir; do pushd $dir >/dev/null; find . -name "*.cpp" | xargs grep "^ *a[A-Z]\w* = " | wc -l | xargs echo $dir; pop

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-14 Thread Kartikaya Gupta
On Tue, Jul 14, 2015 at 10:10 AM, Tom Tromey wrote: >>> That assumes that the 'Foo' of aFoo is stable across function >>> boundaries, which is not always the case. > > Ehsan> No, it doesn't. In the scenario above, all you're looking for is when > Ehsan> a value was computed, so you can quickly se

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-14 Thread Joshua Cranmer 🐧
On 7/14/2015 1:39 AM, Thomas Zimmermann wrote: When writing code, I consider it good style to not write into anything that starts with an 'a' prefix, except result arguments. "You should never write into something with an 'a' prefix except when you should," if you simplify it. I've actually av

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-14 Thread Ehsan Akhgari
On 2015-07-14 10:10 AM, Tom Tromey wrote: That assumes that the 'Foo' of aFoo is stable across function boundaries, which is not always the case. Ehsan> No, it doesn't. In the scenario above, all you're looking for is when Ehsan> a value was computed, so you can quickly see an aDuck, aQuack, E

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-14 Thread Tom Tromey
>> That assumes that the 'Foo' of aFoo is stable across function >> boundaries, which is not always the case. Ehsan> No, it doesn't. In the scenario above, all you're looking for is when Ehsan> a value was computed, so you can quickly see an aDuck, aQuack, Ehsan> aFoopyFoo and determine that the

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-14 Thread Ehsan Akhgari
On 2015-07-14 9:59 AM, Kyle Huey wrote: On Tue, Jul 14, 2015 at 6:57 AM, Ehsan Akhgari mailto:ehsan.akhg...@gmail.com>> wrote: On 2015-07-13 3:07 PM, Jeff Gilbert wrote: On Sun, Jul 12, 2015 at 6:45 PM, Thomas Zimmermann mailto:tzimmerm...@mozilla.com>> wrote:

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-14 Thread Kyle Huey
On Tue, Jul 14, 2015 at 6:57 AM, Ehsan Akhgari wrote: > On 2015-07-13 3:07 PM, Jeff Gilbert wrote: > >> On Sun, Jul 12, 2015 at 6:45 PM, Thomas Zimmermann < >> tzimmerm...@mozilla.com> >> wrote: >> >> Am 08.07.2015 um 16:36 schrieb smaug: >>> Do you actually have any data how many % of Geck

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-14 Thread Ehsan Akhgari
On 2015-07-13 3:07 PM, Jeff Gilbert wrote: On Sun, Jul 12, 2015 at 6:45 PM, Thomas Zimmermann wrote: Am 08.07.2015 um 16:36 schrieb smaug: Do you actually have any data how many % of Gecko devs would prefer not using aFoo? I strongly prefer 'aFoo' over 'foo' for the extra context that it gi

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-13 Thread Thomas Zimmermann
Hi Am 13.07.2015 um 21:07 schrieb Jeff Gilbert: > On Sun, Jul 12, 2015 at 6:45 PM, Thomas Zimmermann > mailto:tzimmerm...@mozilla.com>> wrote: > > Am 08.07.2015 um 16:36 schrieb smaug: > > Do you actually have any data how many % of Gecko devs would prefer > > not using aFoo? > > I

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-13 Thread Kearwood "Kip" Gilbert
I would defer to the expert on the subject: https://imgflip.com/i/o5r8m - Kip On 2015-07-07 6:17 PM, David Anderson wrote: > +1 for removing this. Gecko's use is inconsistent, and outside of Gecko code > that does use it, I've never seen it used in any other codebase. I've never > gone to anot

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-13 Thread Jeff Gilbert
On Sun, Jul 12, 2015 at 6:45 PM, Thomas Zimmermann wrote: > Am 08.07.2015 um 16:36 schrieb smaug: > > Do you actually have any data how many % of Gecko devs would prefer > > not using aFoo? > > I strongly prefer 'aFoo' over 'foo' for the extra context that it gives > to the variable. If we want t

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-13 Thread Jeff Gilbert
On Sun, Jul 12, 2015 at 10:45 PM, Nicholas Nethercote < n.netherc...@gmail.com> wrote: > On Thu, Jul 9, 2015 at 7:01 PM, Jeff Gilbert wrote: > > > > Arguments have the same lifetimes as locals, and the only exceptions to > > this apply to both args and locals. (references and pointers) > > Maybe

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-12 Thread Nicholas Nethercote
On Thu, Jul 9, 2015 at 7:01 PM, Jeff Gilbert wrote: > > Arguments have the same lifetimes as locals, and the only exceptions to > this apply to both args and locals. (references and pointers) Maybe I've misunderstood what you're saying here, but locals are frequently block-scoped which gives them

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-12 Thread Thomas Zimmermann
Am 08.07.2015 um 16:36 schrieb smaug: > Do you actually have any data how many % of Gecko devs would prefer > not using aFoo? I strongly prefer 'aFoo' over 'foo' for the extra context that it gives to the variable. If we want to change anything we should rather introduce a separate prefix for outp

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-10 Thread Bobby Holley
On Thu, Jul 9, 2015 at 7:01 PM, Jeff Gilbert wrote: > FWIW, I hacked a python script that does s/aF[Oo]o/foo/ poiru has the tools to do this already, as mentioned above. > , and MSVC does has > a code analysis mode that supports an error-on-warn for shadowed variable > names. > > I can take a

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-09 Thread Jeff Gilbert
On Wed, Jul 8, 2015 at 7:48 AM, smaug wrote: > Another example where aFoo tends to be rather useful is lifetime > management. > If I see aFoo being used somewhere in a method after some unsafe method > call > (layout flush, any script callback handling, event dispatch, observer > service notifica

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-08 Thread Karl Tomlinson
Bobby Holley writes: > On Wed, Jul 8, 2015 at 4:45 PM, Karl Tomlinson wrote: > >> I think we could relax the 'a' prefix requirement to be a >> convention used when identifying the variable as a parameter is >> useful. My opinion is that this is useful for most parameters in >> all non-trivial fu

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-08 Thread Bobby Holley
On Wed, Jul 8, 2015 at 4:45 PM, Karl Tomlinson wrote: > I think we could relax the 'a' prefix requirement to be a > convention used when identifying the variable as a parameter is > useful. My opinion is that this is useful for most parameters in > all non-trivial functions, but others disagree.

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-08 Thread Karl Tomlinson
Bobby Holley writes: > On Wed, Jul 8, 2015 at 3:52 AM, Gabor Krizsanits > wrote: > >> The priority is to automatically rewrite our source with a unified style. >>> foo -> aFoo is reasonably safe, whereas aFoo->foo is not, at least with >>> the >>> current tools. So we either need to combine the r

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-08 Thread Honza Bambas
On 7/8/2015 3:08, Gregory Szorc wrote: On Tue, Jul 7, 2015 at 5:13 PM, Jeff Gilbert wrote: On Tue, Jul 7, 2015 at 3:59 PM, Eric Rahm wrote: I'm not a huge fan of the 'aFoo' style, but I am a huge fan of consistency. So if we want to change the style guide we should update our codebase, and

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-08 Thread Bobby Holley
On Wed, Jul 8, 2015 at 3:52 AM, Gabor Krizsanits wrote: > The priority is to automatically rewrite our source with a unified style. >> foo -> aFoo is reasonably safe, whereas aFoo->foo is not, at least with >> the >> current tools. So we either need to combine the rewrite tools with static >> ana

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-08 Thread smaug
On 07/07/2015 11:34 PM, Jeff Gilbert wrote: Outvars are good candidates for having markings in the variable name. `aFoo` for all arguments is a poor solution for this, though. On Tue, Jul 7, 2015 at 1:22 PM, smaug wrote: On 07/07/2015 11:18 PM, Jeff Gilbert wrote: On Tue, Jul 7, 2015 at 1:0

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-08 Thread smaug
Do you actually have any data how many % of Gecko devs would prefer not using aFoo? I mean it makes no sense to change to foo, if most of the devs prefer aFoo. Similarly I would stop objecting the change if majority of the devs say "yes, please change this coding style which Mozilla has had forev

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-08 Thread smaug
On 07/08/2015 04:05 AM, Milan Sreckovic wrote: Jeff encouraged me to add more things to this thread, so I’m blaming him. So, some random thoughts. After getting paid to write code for 20+ years and then showing up at Mozilla, and seeing the a prefix, I thought “this is brilliant, how come we

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-08 Thread Nathan Froyd
On Wed, Jul 8, 2015 at 6:52 AM, Gabor Krizsanits wrote: > On Wed, Jul 8, 2015 at 1:05 AM, Bobby Holley > wrote: > > The priority is to automatically rewrite our source with a unified style. > > foo -> aFoo is reasonably safe, whereas aFoo->foo is not, at least with > the > > current tools. So we

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-08 Thread Gabor Krizsanits
On Wed, Jul 8, 2015 at 1:05 AM, Bobby Holley wrote: > On Tue, Jul 7, 2015 at 3:59 PM, Eric Rahm wrote: > > > I'm not a huge fan of the 'aFoo' style, but I am a huge fan of > > consistency. So if we want to change the style guide we should update our > > codebase, and I don't think we can reasona

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Justin Dolske
On 7/7/15 6:17 PM, David Anderson wrote: +1 for removing this. Gecko's use is inconsistent, and outside of Gecko code that does use it, I've never seen it used in any other codebase. I've never gone to another project and thought, "I miss decorating everything in a way that changes capitalization

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Jeff Gilbert
On Mon, Jul 6, 2015 at 8:26 PM, Mike Hommey wrote: > The existence of aFoo goes along with the existence of mFoo, sFoo, kFoo, > and others I might have forgotten. Not that I particularly care about > aFoo, but why strike this one and not the others?[1] It's not like they > have widespread use in

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Karl Tomlinson
Jeff Gilbert writes: > On Tue, Jul 7, 2015 at 5:41 PM, Karl Tomlinson wrote: > >> Some people find the prefix helps readability, because it makes >> extra information immediately available in the code being >> examined, while you are indicating that this is a significant >> burden on readability.

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Jeff Gilbert
On Tue, Jul 7, 2015 at 6:06 PM, Karl Tomlinson wrote: > Jeff Gilbert writes: > > > I work with a number of these, but after a page or two, why is it at all > > relevant which vars were args? For information flow? Should we mark > locals > > that purely derive from args as `aFoo` as well? Long fun

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Jeff Gilbert
On Tue, Jul 7, 2015 at 5:41 PM, Karl Tomlinson wrote: > Jeff Gilbert writes: > > > It can be a burden on the hundreds of devs who have to read and > understand > > the code in order to write more code. > > Some people find the prefix helps readability, because it makes > extra information immedia

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread David Anderson
+1 for removing this. Gecko's use is inconsistent, and outside of Gecko code that does use it, I've never seen it used in any other codebase. I've never gone to another project and thought, "I miss decorating everything in a way that changes capitalization and impairs canonical naming". Reasons

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread David Anderson
+1 for removing this. Gecko's use is inconsistent, and outside of Gecko code that does use it, I've never seen it used in any other codebase. I've never gone to another project and thought, "I miss decorating everything in a way that changes capitalization and impairs canonical naming". Reasons

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Karl Tomlinson
Jeff Gilbert writes: > I work with a number of these, but after a page or two, why is it at all > relevant which vars were args? For information flow? Should we mark locals > that purely derive from args as `aFoo` as well? Long functions (which have > poor readability anyway) generally have so muc

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Gregory Szorc
On Tue, Jul 7, 2015 at 5:13 PM, Jeff Gilbert wrote: > On Tue, Jul 7, 2015 at 3:59 PM, Eric Rahm wrote: > > > I'm not a huge fan of the 'aFoo' style, but I am a huge fan of > > consistency. So if we want to change the style guide we should update our > > codebase, and I don't think we can reasona

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Milan Sreckovic
Jeff encouraged me to add more things to this thread, so I’m blaming him. So, some random thoughts. After getting paid to write code for 20+ years and then showing up at Mozilla, and seeing the a prefix, I thought “this is brilliant, how come we didn’t think of doing that before?!”, as a reas

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Karl Tomlinson
Jeff Gilbert writes: > It can be a burden on the hundreds of devs who have to read and understand > the code in order to write more code. Some people find the prefix helps readability, because it makes extra information immediately available in the code being examined, while you are indicating th

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Nicholas Nethercote
On Tue, Jul 7, 2015 at 5:13 PM, Jeff Gilbert wrote: > > MSVC 2013 (which I believe is our main windows compiler right now) will > error during compilation if such a shadowing issue arises. Thus, if the > code compiles there, `aFoo`->`foo` is safe. I would be very surprised if > GCC or Clang didn't

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Mike Hommey
On Tue, Jul 07, 2015 at 05:09:57PM -0700, Gregory Szorc wrote: > On Tue, Jul 7, 2015 at 1:03 PM, smaug wrote: > > > As someone who spends more than 50% of working time doing reviews I'm > > strongly against this proposal. > > aFoo helps with readability - reader knows immediately when the code is

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Jeff Gilbert
On Tue, Jul 7, 2015 at 3:59 PM, Eric Rahm wrote: > I'm not a huge fan of the 'aFoo' style, but I am a huge fan of > consistency. So if we want to change the style guide we should update our > codebase, and I don't think we can reasonably do that automatically without > introducing shadowing issue

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Gregory Szorc
On Tue, Jul 7, 2015 at 1:03 PM, smaug wrote: > As someone who spends more than 50% of working time doing reviews I'm > strongly against this proposal. > aFoo helps with readability - reader knows immediately when the code is > dealing with arguments. > > I'd like to point out that MozReview allow

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Xidorn Quan
On Tue, Jul 7, 2015 at 1:12 PM, Jeff Gilbert wrote: > > Notable works or style guides which *do* recommend `aFoo`: > * Mozilla (except for IDL, Java, and Python) > * ? > Just FYI, Someone in Twitter mentioned that, code generated by Xcode uses this style by default. The languages are Obj-C and S

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Bobby Holley
On Tue, Jul 7, 2015 at 3:59 PM, Eric Rahm wrote: > I'm not a huge fan of the 'aFoo' style, but I am a huge fan of > consistency. So if we want to change the style guide we should update our > codebase, and I don't think we can reasonably do that automatically without > introducing shadowing issue

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Eric Rahm
On Tuesday, July 7, 2015 at 3:30:59 PM UTC-7, Birunthan Mohanathas wrote: > On 7 July 2015 at 15:02, Mike Hommey wrote: > > On Tue, Jul 07, 2015 at 11:52:12PM +0300, smaug wrote: > >> until the tools (and poiru) are run and make the code follow Mozilla > >> coding style. > > > > Assuming you're t

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Birunthan Mohanathas
On 7 July 2015 at 15:02, Mike Hommey wrote: > On Tue, Jul 07, 2015 at 11:52:12PM +0300, smaug wrote: >> until the tools (and poiru) are run and make the code follow Mozilla coding >> style. > > Assuming you're talking about clang-format, that doesn't take care > about anything else than whitespac

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Bobby Holley
On Tue, Jul 7, 2015 at 3:02 PM, Mike Hommey wrote: > On Tue, Jul 07, 2015 at 11:52:12PM +0300, smaug wrote: > > On 07/07/2015 11:45 PM, Milan Sreckovic wrote: > > > > > >Removing the style guide for “prefix function arguments with a” will > not preclude people from naming a variable aFoo. At lea

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Mike Hommey
On Tue, Jul 07, 2015 at 11:52:12PM +0300, smaug wrote: > On 07/07/2015 11:45 PM, Milan Sreckovic wrote: > > > >Removing the style guide for “prefix function arguments with a” will not > >preclude people from naming a variable aFoo. At least the current style > >guide precludes people from naming

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread smaug
On 07/07/2015 11:45 PM, Milan Sreckovic wrote: Removing the style guide for “prefix function arguments with a” will not preclude people from naming a variable aFoo. At least the current style guide precludes people from naming non-function arguments that way, albeit indirectly. I’m trying to

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Kartikaya Gupta
On Tue, Jul 7, 2015 at 3:33 PM, Jeff Gilbert wrote: > On Tue, Jul 7, 2015 at 6:03 AM, Kartikaya Gupta wrote: >> >> I'd be interested to know: of those people who are in favour of >> removing the prefix, how many regularly have to deal with functions >> that are longer than two pages (a "page" is

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Milan Sreckovic
Removing the style guide for “prefix function arguments with a” will not preclude people from naming a variable aFoo. At least the current style guide precludes people from naming non-function arguments that way, albeit indirectly. I’m trying to understand the possible outcomes of this particu

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Nicholas Hurley
On Mon, Jul 6, 2015 at 8:12 PM, Jeff Gilbert wrote: > I propose that we stop recommending the universal use of an 'a' prefix for > arguments to functions in C and C++. If the prefix helps with > disambiguation, that's fine. However, use of this prefix should not be > prescribed in general. > I d

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Jeff Gilbert
Outvars are good candidates for having markings in the variable name. `aFoo` for all arguments is a poor solution for this, though. On Tue, Jul 7, 2015 at 1:22 PM, smaug wrote: > On 07/07/2015 11:18 PM, Jeff Gilbert wrote: > >> On Tue, Jul 7, 2015 at 1:03 PM, smaug wrote: >> >> As someone who

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Jeff Gilbert
On Tue, Jul 7, 2015 at 1:20 PM, smaug wrote: > readability / easier to follow the dataflow are rather compelling reasons. > It hurts readability for me and many others. I don't see how it revolutionizes following dataflow, since we have locals that are pure functions of args, but yet are not mar

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Jet Villegas
On Mon, Jul 6, 2015 at 8:12 PM, Jeff Gilbert wrote: > > I propose we strike the `aFoo` recommendation from the Mozilla style guide. > Just so the proposal doesn't get lost in the bike shed, Jeff is only proposing a change to the style guide, not a tree-wide find/replace project. I take that to

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread smaug
On 07/07/2015 11:18 PM, Jeff Gilbert wrote: On Tue, Jul 7, 2015 at 1:03 PM, smaug wrote: As someone who spends more than 50% of working time doing reviews I'm strongly against this proposal. aFoo helps with readability - reader knows immediately when the code is dealing with arguments. When

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread smaug
On 07/07/2015 10:55 PM, Jeff Gilbert wrote: On Tue, Jul 7, 2015 at 12:36 PM, Honza Bambas wrote: On 7/7/2015 21:27, Jeff Gilbert wrote: On Tue, Jul 7, 2015 at 4:54 AM, Honza Bambas wrote: I'm strongly against removing the prefix. I got used to this and it has its meaning all the time I

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Jeff Gilbert
On Tue, Jul 7, 2015 at 1:03 PM, smaug wrote: > As someone who spends more than 50% of working time doing reviews I'm > strongly against this proposal. > aFoo helps with readability - reader knows immediately when the code is > dealing with arguments. > When and why is this useful to know? __

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread smaug
As someone who spends more than 50% of working time doing reviews I'm strongly against this proposal. aFoo helps with readability - reader knows immediately when the code is dealing with arguments. -Olli On 07/07/2015 06:12 AM, Jeff Gilbert wrote: I propose that we stop recommending the uni

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Jeff Gilbert
On Tue, Jul 7, 2015 at 12:36 PM, Honza Bambas wrote: > On 7/7/2015 21:27, Jeff Gilbert wrote: > >> On Tue, Jul 7, 2015 at 4:54 AM, Honza Bambas wrote: >> >> I'm strongly against removing the prefix. I got used to this and it has >>> its meaning all the time I inspect code (even my own) and doi

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Honza Bambas
On 7/7/2015 21:27, Jeff Gilbert wrote: On Tue, Jul 7, 2015 at 4:54 AM, Honza Bambas wrote: I'm strongly against removing the prefix. I got used to this and it has its meaning all the time I inspect code (even my own) and doing reviews. Recognizing a variable is an argument is very very useful

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Jeff Gilbert
On Tue, Jul 7, 2015 at 6:03 AM, Kartikaya Gupta wrote: > I'd be interested to know: of those people who are in favour of > removing the prefix, how many regularly have to deal with functions > that are longer than two pages (a "page" is however much code you can > see at a time in your coding env

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Jeff Gilbert
On Tue, Jul 7, 2015 at 4:54 AM, Honza Bambas wrote: > I'm strongly against removing the prefix. I got used to this and it has > its meaning all the time I inspect code (even my own) and doing reviews. > Recognizing a variable is an argument is very very useful. It's important > to have it and i

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Luke Wagner
If we do unify Gecko/SpiderMonkey styles (something it seems like we're moving towards and I think would be great), it would be a real shame to switch 'cx' (a parameter to basically every function in SpiderMonkey) to 'aCx'; that would really make some eyes bleed. One compromise could be to drop th

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Honza Bambas
On 7/7/2015 19:38, Boris Zbarsky wrote: On 7/7/15 11:49 AM, Mike Conley wrote: I suspect that knowing what things were passed into a method or function is something that can be divined via static analysis. Aren't there tools for our (admittedly varied) editors / IDEs And debuggers. And dxr a

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Boris Zbarsky
On 7/7/15 11:49 AM, Mike Conley wrote: I suspect that knowing what things were passed into a method or function is something that can be divined via static analysis. Aren't there tools for our (admittedly varied) editors / IDEs And debuggers. And dxr and blame views? -Boris _

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Eric Shepherd
> Karl Tomlinson > July 7, 2015 at 12:55 AM > > I find the 'a' prefix useful to tell me that this variable has the > value that was provided to the function. > (I'm assuming that the prefix is used with this convention.) > > There's no additional safety enforced, but I fi

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Gregory Szorc
On Tue, Jul 7, 2015 at 9:29 AM, Nathan Froyd wrote: > On Tue, Jul 7, 2015 at 11:49 AM, Mike Conley wrote: > > > Aren't there tools for our (admittedly varied) editors / IDEs to make > > the readability that people are getting from aFoo readily available, but > > that don't also require us to pac

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Eric Rescorla
On Tue, Jul 7, 2015 at 6:03 AM, Kartikaya Gupta wrote: > I'd be interested to know: of those people who are in favour of > removing the prefix, how many regularly have to deal with functions > that are longer than two pages (a "page" is however much code you can > see at a time in your coding env

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Nathan Froyd
On Tue, Jul 7, 2015 at 11:49 AM, Mike Conley wrote: > Aren't there tools for our (admittedly varied) editors / IDEs to make > the readability that people are getting from aFoo readily available, but > that don't also require us to pack it into the actual name of the variable? I find it useful f

Re: Proposal to remove `aFoo` prescription from the Mozilla style guide for C and C++

2015-07-07 Thread Mike Conley
I suspect that knowing what things were passed into a method or function is something that can be divined via static analysis. Aren't there tools for our (admittedly varied) editors / IDEs to make the readability that people are getting from aFoo readily available, but that don't also require us t

  1   2   >