Namespaces for new features

46 views
Skip to first unread message

ttuttle

unread,
Nov 4, 2013, 2:05:06 PM11/4/13
to chromium-dev
Hi chromium-dev,

I'm implementing a new feature that's gonna end up somewhere like
chrome/browser/foobar_bazquux/*. To avoid unwieldy class names like
FoobarBazquuxSomethingOrOther, I'd like to put my feature in namespace
foobar_bazquux. Is that acceptable?

Captive portal does something similar ("namespace captive_portal",
although it also prefixes class names with CaptivePortal), so it seems
reasonable to me.

Thoughts?

Thanks,

ttuttle

Thiago Farina

unread,
Nov 4, 2013, 3:47:37 PM11/4/13
to ttu...@chromium.org, chromium-dev, Peter Kasting, John Abd-El-Malek
On Mon, Nov 4, 2013 at 5:05 PM, ttuttle <ttu...@chromium.org> wrote:
> Hi chromium-dev,
>
> I'm implementing a new feature that's gonna end up somewhere like
> chrome/browser/foobar_bazquux/*. To avoid unwieldy class names like
> FoobarBazquuxSomethingOrOther, I'd like to put my feature in namespace
> foobar_bazquux. Is that acceptable?
>
No, as far as I know. We discussed this here
https://groups.google.com/a/chromium.org/d/topic/chromium-dev/pcgYLSJsii8/discussion,
and if I'm not wrong, we decided that code under chrome/ directory
should live in global namespace.


--
Thiago

Chris Hopman

unread,
Nov 4, 2013, 4:20:23 PM11/4/13
to Thiago Farina, ttu...@chromium.org, chromium-dev, Peter Kasting, John Abd-El-Malek
I disagree with your interpretation of that previous discussion. It looks like there was consensus that we should not use a chrome:: namespace, but the question of whether or not a feature like foobar_bazquux or history or extensions should have their own namespace was left undecided.



--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
    http://groups.google.com/a/chromium.org/group/chromium-dev

Peter Kasting

unread,
Nov 4, 2013, 4:24:49 PM11/4/13
to Chris Hopman, Thiago Farina, ttu...@chromium.org, chromium-dev, John Abd-El-Malek
On Mon, Nov 4, 2013 at 1:20 PM, Chris Hopman <cjho...@chromium.org> wrote:
I disagree with your interpretation of that previous discussion. It looks like there was consensus that we should not use a chrome:: namespace, but the question of whether or not a feature like foobar_bazquux or history or extensions should have their own namespace was left undecided.

That also matches my understanding of the conversation.

For new features, I would suggest avoiding namespaces in any case.  The majority of Chrome features do not use them, and namespace usage is a bit contentious.  Appropriately-named classes are clear and uncontentious, even if they occasionally make code verbose.

PK 

Paweł Hajdan, Jr.

unread,
Nov 4, 2013, 8:16:24 PM11/4/13
to Peter Kasting, Chris Hopman, Thiago Farina, ttu...@chromium.org, chromium-dev, John Abd-El-Malek
Note that maybe the feature should be a browser component instead, see http://www.chromium.org/developers/design-documents/browser-components

Paweł


--
Reply all
Reply to author
Forward
0 new messages