Re: Proposed style guide modification: using declarations and nested namespaces

2012-11-13 Thread Jeff Walden
On 11/13/2012 01:34 AM, Robert O'Callahan wrote: > Why is "using mozilla::RangedPtr" required; is "RangedPtr" ambiguous? It's not -- just the increasing concern about using-collisions if we open the whole mozilla namespace, which we'd rather not do because of the possibility (actuality, for Rang

Re: Proposed style guide modification: using declarations and nested namespaces

2012-11-13 Thread Neil
Robert O'Callahan wrote: On Mon, Nov 12, 2012 at 8:37 PM, Jeff Walden wrote: We ended up removing the nested |using| above and making all SpiderMonkey headers qualify everything with mozilla::. We use few enough things from mozilla:: so far that we switched to |using mozilla::RangedPtr| an

Re: Proposed style guide modification: using declarations and nested namespaces

2012-11-13 Thread Robert O'Callahan
On Mon, Nov 12, 2012 at 8:37 PM, Jeff Walden wrote: > We ended up removing the nested |using| above and making all SpiderMonkey > headers qualify everything with mozilla::. We use few enough things from > mozilla:: so far that we switched to |using mozilla::RangedPtr| and so on > in .cpp files a

Re: Proposed style guide modification: using declarations and nested namespaces

2012-11-12 Thread Jeff Walden
On 11/12/2012 10:44 AM, Robert O'Callahan wrote: > On Mon, Nov 12, 2012 at 9:37 AM, Zack Weinberg wrote: > >> The scenario I'm concerned with is when a .cpp file does 'using namespace >> A;' and then goes on to define a bunch of its *own* symbols; later someone >> adds a symbol to namespace A, an

Re: Proposed style guide modification: using declarations and nested namespaces

2012-11-12 Thread Zack Weinberg
On 2012-11-12 1:44 PM, Robert O'Callahan wrote: On Mon, Nov 12, 2012 at 9:37 AM, Zack Weinberg wrote: The scenario I'm concerned with is when a .cpp file does 'using namespace A;' and then goes on to define a bunch of its *own* symbols; later someone adds a symbol to namespace A, and gets an u

Re: Proposed style guide modification: using declarations and nested namespaces

2012-11-12 Thread Robert O'Callahan
On Mon, Nov 12, 2012 at 9:37 AM, Zack Weinberg wrote: > The scenario I'm concerned with is when a .cpp file does 'using namespace > A;' and then goes on to define a bunch of its *own* symbols; later someone > adds a symbol to namespace A, and gets an unexpected break possibly miles > from their o

Re: Proposed style guide modification: using declarations and nested namespaces

2012-11-12 Thread Zack Weinberg
On 2012-11-10 12:58 AM, Robert O'Callahan wrote: What exactly is the benefit here? As far as I know, "using namespace A; using namespace B;" where both A and B define Foo doesn't actually cause a compile error unless/until the code actually references "Foo". The scenario I'm concerned with is

Re: Proposed style guide modification: using declarations and nested namespaces

2012-11-09 Thread Robert O'Callahan
On Fri, Nov 9, 2012 at 11:03 PM, Zack Weinberg wrote: > I challenge your presuppositions. The average file should need no more > than one or two `using SYMBOL;` lines per header it includes. Maintaining > this will not be significantly more difficult than maintaining the existing > lists of head

Re: Proposed style guide modification: using declarations and nested namespaces

2012-11-09 Thread Boris Zbarsky
On 11/9/12 8:03 PM, Zack Weinberg wrote: I challenge your presuppositions. The average file should need no more than one or two `using SYMBOL;` lines per header it includes. That depends on the structure of the code, no? For example, until we finish moving over all of the DOM to live inside

Re: Proposed style guide modification: using declarations and nested namespaces

2012-11-09 Thread Boris Zbarsky
On 11/9/12 8:11 PM, Benoit Jacob wrote: The only issue I see is using namespace at file scope in a _header file_. I would support a coding style rule against that. https://developer.mozilla.org/en-US/docs/Developer_Guide/Coding_Style#Namespaces says: No "using" statements are allowed in h

Re: Proposed style guide modification: using declarations and nested namespaces

2012-11-09 Thread Benoit Jacob
2012/11/9 Zack Weinberg : > On 2012-11-09 1:28 PM, Kyle Huey wrote: >> >> I reviewed a patch today that had: >> >> using namespace mozilla; >> using namespace dom; > > > The style guide should forbid `using namespace` altogether. Use only what > you need. In a given cpp file (in a single TU), as

Re: Proposed style guide modification: using declarations and nested namespaces

2012-11-09 Thread Zack Weinberg
On 2012-11-09 10:49 PM, Robert O'Callahan wrote: On Fri, Nov 9, 2012 at 10:14 PM, Zack Weinberg wrote: The style guide should forbid `using namespace` altogether. Use only what you need. I really don't think it should. I do not want to see source files full of difficult-to-maintain and unn

Re: Proposed style guide modification: using declarations and nested namespaces

2012-11-09 Thread Robert O'Callahan
On Fri, Nov 9, 2012 at 10:14 PM, Zack Weinberg wrote: > The style guide should forbid `using namespace` altogether. Use only what > you need. I really don't think it should. I do not want to see source files full of difficult-to-maintain and unnecessary "using" boilerplate a la Java "import".

Re: Proposed style guide modification: using declarations and nested namespaces

2012-11-09 Thread Zack Weinberg
On 2012-11-09 1:28 PM, Kyle Huey wrote: I reviewed a patch today that had: using namespace mozilla; using namespace dom; The style guide should forbid `using namespace` altogether. Use only what you need. ___ dev-platform mailing list dev-platfor

Re: Proposed style guide modification: using declarations and nested namespaces

2012-11-09 Thread Ehsan Akhgari
On 2012-11-09 3:40 PM, Chris Peterson wrote: On 11/9/12 11:53 AM, Ehsan Akhgari wrote: using namespace mozilla; using namespace mozilla::dom; The style guidelines recommend against using nested namespaces, so doing what you suggest would make them self-inconsistent. But we have some nested n

Re: Proposed style guide modification: using declarations and nested namespaces

2012-11-09 Thread Chris Peterson
On 11/9/12 11:53 AM, Ehsan Akhgari wrote: using namespace mozilla; using namespace mozilla::dom; The style guidelines recommend against using nested namespaces, so doing what you suggest would make them self-inconsistent. But we have some nested namespaces today, so `using` them like Kyle su

Re: Proposed style guide modification: using declarations and nested namespaces

2012-11-09 Thread Ehsan Akhgari
On 2012-11-09 1:28 PM, Kyle Huey wrote: I reviewed a patch today that had: using namespace mozilla; using namespace dom; The intent is to pull in the contents of both the mozilla and mozilla::dom namespaces, but this is only clear if you know that there is no top-level dom namespace. In the re

Re: Proposed style guide modification: using declarations and nested namespaces

2012-11-09 Thread Kyle Huey
On Fri, Nov 9, 2012 at 10:46 AM, Gregory Szorc wrote: > On 11/9/12 10:28 AM, Kyle Huey wrote: > >> I reviewed a patch today that had: >> >> using namespace mozilla; >> using namespace dom; >> >> The intent is to pull in the contents of both the mozilla and mozilla::dom >> namespaces, but this is

Re: Proposed style guide modification: using declarations and nested namespaces

2012-11-09 Thread Gregory Szorc
On 11/9/12 10:28 AM, Kyle Huey wrote: I reviewed a patch today that had: using namespace mozilla; using namespace dom; The intent is to pull in the contents of both the mozilla and mozilla::dom namespaces, but this is only clear if you know that there is no top-level dom namespace. In the revi

Proposed style guide modification: using declarations and nested namespaces

2012-11-09 Thread Kyle Huey
I reviewed a patch today that had: using namespace mozilla; using namespace dom; The intent is to pull in the contents of both the mozilla and mozilla::dom namespaces, but this is only clear if you know that there is no top-level dom namespace. In the review comments I asked the author to write