On 7/6/18 8:21 PM, Ehsan Akhgari wrote:
On Fri, Jun 29, 2018 at 2:36 PM, smaug <sm...@welho.com> wrote:
On 06/29/2018 05:58 PM, Boris Zbarsky wrote:
On 6/29/18 10:30 AM, Nathan Froyd wrote:
Given the language-required qualification for
`enum class` and a more Rust-alike syntax, I would feel comfortable
with saying CamelCase `enum class` is the way to go.
For what it's worth, I agree. The point of the "e" prefix is to
highlight that you have an enumeration and add some poor-man's namespacing
for a potentially large number of common-looking names, and the
language-required qualification already handles both of those.
That works if we're consistently naming static variables and such using
s-prefix etc, so that
class Foo1
{
static int sBar;
};
Foo1::sBar
is clearly different to
enum class Foo2
{
Bar
};
Foo2::Bar
(personally I'd still prefer using e-prefix always with enums, class or
not. Foo1::sBar vs Foo2::eBar is easier to distinguish than Foo1::sBar vs
Foo2::Bar)
Looking at other popular style guidelines, the Google C++ style requires
the 'k' prefix on both enum and enum class <
https://google.github.io/styleguide/cppguide.html#Enumerator_Names>
presumably because it doesn't require any special prefix for static
members. But given that ours does, it seems that in the case of enum
classes, not using a prefix should be acceptable.
Based on Nathan's analysis (thanks, Nathan!) and the previous thread, it
seems like Emilio's edit should be reverted and a note should be added
about the usage of CamelCase for enum classes. Emilio, do you mind doing
that, please?
Sure, just did:
https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style$compare?locale=en-US&to=1394287&from=1392024
Feel free to clarify or change as you think it's more useful.
Thanks Ehsan!
-- Emilio
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform