> -----Original Message-----
> From: Tor Arne Vestbø

> > To quote the policy:
> >
> > "By comparison the following example illustrates the dangers of missing type
> safety and giving general names to conventional enum values:"
> > ...
> > " One guideline for naming enum types is to repeat at least one element of 
> > the
> enum type name in each of the enum values"
> >
> > I think the policy is explicit.
> 
> The policy uses a global enum as an example. Obviously we need some sort of
> scoping there, either in the enum value names, or by using scoped enums. We
> agree there, and can leave that part of the discussion as solved.
> 
> The discussion here is about what to do when the enum lives inside a class,
> which would already solve the naming clash issue in most cases.

This is not about namespace clashes or inside or outside classes. It is about 
readability. Unscoped enums don’t require the enum type to be mentioned 
although the type name tremendously helps as context info for enum values. 
Without this context the enum is harder to understand. Hence a more verbose 
name (repeating essential part of the type) is chosen.

And we have not even talked about strong typing of scoped versions (see Eike's 
comment)

Scoped enums have a few advantages which are sufficient for me to accept its 
use. Combine that with a naming policy that is close to what we had for 
unscoped enums and you got a winner for me 😉

--
Alex

_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to