I'm all for reducing usage of 'using' and in .cpp files I've been switching
to doing

    namespace foo {
        // my code
    }

instead of

    using namespace foo;
    // my code

where possible, as the latter leaks to other .cpp files in unified builds
and the former doesn't.

Regarding the proposal to ban 'using' only at root scope only, keep in mind
that we have conflicting *nested* namespaces too:

    mozilla::ipc
    mozilla::dom::ipc

so at least that class of problems won't be solved by this proposal. But I
still agree that it's a step in the right direction.

Benoit


2013/11/29 Mike Hommey <m...@glandium.org>

> On Sat, Nov 30, 2013 at 12:39:59PM +0900, Mike Hommey wrote:
> > Incidentally, in those two weeks, I did two attempts at building
> > without unified sources, resulting in me filing 4 bugs in different
> > modules for problems caused by 6 different landings[1]. I think it is
> time
> > to seriously think about having regular non-unified builds (bug 942167).
> > If that helps, I can do that on birch until that bug is fixed.
>
> Speaking of which, there are essentially two classes of such errors:
> - missing headers.
> - namespace spilling.
>
> The latter is due to one source doing "using namespace foo", and some
> other source forgetting the same because, in the unified case, they
> benefit from the other source doing it. I think in the light of unified
> sources, we should forbid non-scoped use of "using".
>
> That is:
>
>     using namespace foo;
>
> would be forbidden, but
>
>     namespace bar {
>         using namespace foo;
>     }
>
> wouldn't. In most cases, bar could be mozilla anyways.
>
> Thoughts?
>
> Mike
> _______________________________________________
> dev-platform mailing list
> dev-platform@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-platform
>
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to