Re: [Development] Naming convention for (scoped) enums

2018-09-25 Thread Jan-Arve Sæther
to not have this discussion again later. Jan Arve Fra: Development på vegne av Simon Hausmann Sendt: mandag 3. september 2018 16.31.07 Til: development@qt-project.org Emne: Re: [Development] Naming convention for (scoped) enums Am 31.08.18 um 11:56 schrieb

Re: [Development] Naming convention for (scoped) enums

2018-09-03 Thread Simon Hausmann
Am 31.08.18 um 11:56 schrieb Tor Arne Vestbø: I think Simon’s reasoning in the review that spurred this discussion summarises it nicely: On 31 Aug 2018, at 10:24, Simon Hausmann (Code Review) wrote: Simon Hausmann has posted comments on this change. Change subject: Convert QQEventPoint

Re: [Development] Naming convention for (scoped) enums

2018-08-31 Thread Marco Bubke
Enumerations inside of classes makes dependency breaking harder. We don't use that in Qt but users of our interface may do. It's still possible but much more complex because you generally get much more dependencies. A simple header file for enumerations instead can simply be included without

Re: [Development] Naming convention for (scoped) enums

2018-08-31 Thread Tor Arne Vestbø
Hey, > On 31 Aug 2018, at 14:50, Jan-Arve Sæther wrote: > > For me it seems that enum classes can help us create a more structured API, > because they also gives more semantic information, e.g: > QQuickPointerDevice::PointerType::Finger > gives more information than >

Re: [Development] Naming convention for (scoped) enums

2018-08-31 Thread Jan-Arve Sæther
5 øre --- Jan Arve Sæther Senior Software Engineer Fra: Development på vegne av Tor Arne Vestbø Sendt: fredag 31. august 2018 11.56.15 Til: Alex Blasche Kopi: development@qt-project.org Emne: Re: [Development] Naming convention for (scoped) enums I thi

Re: [Development] Naming convention for (scoped) enums

2018-08-31 Thread Eike Ziller
> On 31. Aug 2018, at 11:56, Tor Arne Vestbø wrote: > > I think Simon’s reasoning in the review that spurred this discussion > summarises it nicely: > >> On 31 Aug 2018, at 10:24, Simon Hausmann (Code Review) >> wrote: >> >> Simon Hausmann has posted comments on this change. >> >> Change

Re: [Development] Naming convention for (scoped) enums

2018-08-31 Thread Tor Arne Vestbø
I think Simon’s reasoning in the review that spurred this discussion summarises it nicely: > On 31 Aug 2018, at 10:24, Simon Hausmann (Code Review) > wrote: > > Simon Hausmann has posted comments on this change. > > Change subject: Convert QQEventPoint and QQPointerDevice enums to enum

Re: [Development] Naming convention for (scoped) enums

2018-08-31 Thread Alex Blasche
> -Original Message- > From: Development project.org> On Behalf Of Simon Hausmann > > I don't consider the longer names detrimental for writability and usability. > Writability is easily solved with code completion and readability is actually > better > because the type adds

Re: [Development] Naming convention for (scoped) enums

2018-08-31 Thread Edward Welbourne
Simon Hausmann (31 August 2018 11:01) > If we decide to allow deciding on a case-by-case basis, then I encourage > everyone to carefully look at newly introduced enums, their values and > their context in the upcoming "API review season". or, indeed, s/upcoming/ongoing/ ;-) Eddy.

Re: [Development] Naming convention for (scoped) enums

2018-08-31 Thread Simon Hausmann
On 8/15/18 9:32 AM, Alex Blasche wrote: -Original Message- From: Tor Arne Vestbø 1. Scoped enums (enum class) for the sake of avoiding name clashes is useful for global enums, but when the enum lives inside a class, the chance that we’ll see a naming clash is minor, and using scoped

Re: [Development] Naming convention for (scoped) enums

2018-08-15 Thread André Pönitz
On Wed, Aug 15, 2018 at 07:32:48AM +, Alex Blasche wrote: > I don't think we have ever not permitted exceptions to official > policy. Therefore, take it for granted that the policy can be ignored > such as in the case presented by Allan. Having said that the default > should be the use of

Re: [Development] Naming convention for (scoped) enums

2018-08-15 Thread Eike Ziller
> On 15. Aug 2018, at 11:33, Tor Arne Vestbø wrote: > > > >> On 15 Aug 2018, at 09:32, Alex Blasche wrote: >> >> >> >>> -Original Message- >>> From: Tor Arne Vestbø >>> 1. Scoped enums (enum class) for the sake of avoiding name clashes is >>> useful for >>> global enums, but

Re: [Development] Naming convention for (scoped) enums

2018-08-15 Thread Tor Arne Vestbø
> On 15 Aug 2018, at 09:32, Alex Blasche wrote: > > > >> -Original Message- >> From: Tor Arne Vestbø >> 1. Scoped enums (enum class) for the sake of avoiding name clashes is useful >> for >> global enums, but when the enum lives inside a class, the chance that we’ll >> see a >>

Re: [Development] Naming convention for (scoped) enums

2018-08-15 Thread Alex Blasche
> -Original Message- > From: Tor Arne Vestbø > 1. Scoped enums (enum class) for the sake of avoiding name clashes is useful > for > global enums, but when the enum lives inside a class, the chance that we’ll > see a > naming clash is minor, and using scoped enums in that case arguably

Re: [Development] Naming convention for (scoped) enums

2018-08-14 Thread Tor Arne Vestbø
> On 14 Aug 2018, at 15:29, Allan Sandfeld Jensen wrote: > > I agree, at least in most cases. There are still cases where I would prefer > unscoped enums. For instance in my recent QColorSpace patch, I ended up using > both types of enums under QColorSpace. The enum that represented

Re: [Development] Naming convention for (scoped) enums

2018-08-14 Thread Tor Arne Vestbø
I’ve lost track of what you are arguing for here  To bring the discussion back, here are my main points: 1. Scoped enums (enum class) for the sake of avoiding name clashes is useful for global enums, but when the enum lives inside a class, the chance that we’ll see a naming clash is minor,

Re: [Development] Naming convention for (scoped) enums

2018-08-14 Thread Allan Sandfeld Jensen
On Dienstag, 14. August 2018 14:27:27 CEST Alex Blasche wrote: > > -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

Re: [Development] Naming convention for (scoped) enums

2018-08-14 Thread Eike Ziller
> On 14. Aug 2018, at 13:18, Tor Arne Vestbø wrote: > > >> On 14 Aug 2018, at 13:13, Eike Ziller wrote: >> >> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf states the >> problems that were the driver for creating strongly typed enums: >> >> 1. Implicit conversion to

Re: [Development] Naming convention for (scoped) enums

2018-08-14 Thread Alex Blasche
> -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

Re: [Development] Naming convention for (scoped) enums

2018-08-14 Thread Tor Arne Vestbø
> On 14 Aug 2018, at 13:13, Eike Ziller wrote: > > http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf states the > problems that were the driver for creating strongly typed enums: > > 1. Implicit conversion to integer > 2. Inability to specify underlying type

Re: [Development] Naming convention for (scoped) enums

2018-08-14 Thread Eike Ziller
> On 14. Aug 2018, at 12:30, Tor Arne Vestbø wrote: > >> >> On 14 Aug 2018, at 12:13, Alex Blasche wrote: >> >> >> >>> -Original Message- >>> From: Tor Arne Vestbø >>> That circular logic  Or at least arguing that we should maintain the >>> policy not >>> because it makes sense,

Re: [Development] Naming convention for (scoped) enums

2018-08-14 Thread Tor Arne Vestbø
> On 14 Aug 2018, at 12:13, Alex Blasche wrote: > > > >> -Original Message- >> From: Tor Arne Vestbø >> That circular logic  Or at least arguing that we should maintain the policy >> not >> because it makes sense, but just because we’ve done so in the past. >> >> You are not

Re: [Development] Naming convention for (scoped) enums

2018-08-14 Thread Alex Blasche
> -Original Message- > From: Tor Arne Vestbø > That circular logic  Or at least arguing that we should maintain the policy > not > because it makes sense, but just because we’ve done so in the past. > > You are not questioning _why_ we have done so in the past (for decades as you >

Re: [Development] Naming convention for (scoped) enums

2018-08-14 Thread Tor Arne Vestbø
> On 14 Aug 2018, at 09:16, Alex Blasche wrote: > >> I >> do not think that using class enums inside existing classes is a win for code >> readability/writability: >> >> When you have >> >> switch (point->state()) { >> >> It's pretty obvious what case QQuickEventPoint::Pressed: refers to.

Re: [Development] Naming convention for (scoped) enums

2018-08-14 Thread Alex Blasche
> -Original Message- > From: Tor Arne Vestbø > Sent: Monday, 13 August 2018 16:40 > To: Alex Blasche > Cc: development@qt-project.org; Simon Hausmann > Subject: Re: [Development] Naming convention for (scoped) enums > > Bringing this up again in light of e.

Re: [Development] Naming convention for (scoped) enums

2018-08-13 Thread Shawn Rutledge
On Aug 13, 2018, at 18:12, Giuseppe D'Angelo via Development wrote: > Il 13/08/2018 16:40, Tor Arne Vestbø ha scritto: >> Or: >> if (event->device()->pointerType() != QQuickPointerDevice::Finger >> Gives me all the info I need, and having to type or read this instead is >> worse in my

Re: [Development] Naming convention for (scoped) enums

2018-08-13 Thread Edward Welbourne
Il 13/08/2018 16:40, Tor Arne Vestbø ha scritto: >>> Or: >>> if (event->device()->pointerType() != QQuickPointerDevice::Finger >>> Gives me all the info I need, and having to type or read this >>> instead is worse in my opinion: On 13 Aug 2018, at 18:12, Giuseppe D'Angelo via Development

Re: [Development] Naming convention for (scoped) enums

2018-08-13 Thread Tor Arne Vestbø
On 13 Aug 2018, at 18:12, Giuseppe D'Angelo via Development wrote: > > Il 13/08/2018 16:40, Tor Arne Vestbø ha scritto: >> Or: >> if (event->device()->pointerType() != QQuickPointerDevice::Finger >> Gives me all the info I need, and having to type or read this instead is >> worse in my

Re: [Development] Naming convention for (scoped) enums

2018-08-13 Thread Giuseppe D'Angelo via Development
Il 13/08/2018 16:40, Tor Arne Vestbø ha scritto: Or: if (event->device()->pointerType() != QQuickPointerDevice::Finger Gives me all the info I need, and having to type or read this instead is worse in my opinion: This is actually against the old "non-enum class" coding standards: one

Re: [Development] Naming convention for (scoped) enums

2018-08-13 Thread Tor Arne Vestbø
Tuesday, 22 May 2018 9:30:18 AM > To: Christian Kandeler > Cc: Qt development mailing list > Subject: Re: [Development] Naming convention for (scoped) enums > > > >> On 17 May 2018, at 11:35, Christian Kandeler >> wrote: >> >> On Thu, 17 May 2018 08:14:15

Re: [Development] Naming convention for (scoped) enums

2018-05-22 Thread Alex Blasche
sday, 22 May 2018 9:30:18 AM To: Christian Kandeler Cc: Qt development mailing list Subject: Re: [Development] Naming convention for (scoped) enums > On 17 May 2018, at 11:35, Christian Kandeler <christian.kande...@qt.io> wrote: > > On Thu, 17 May 2018 08:14:15 + > Alex Bl

Re: [Development] Naming convention for (scoped) enums

2018-05-22 Thread Lars Knoll
> On 17 May 2018, at 11:35, Christian Kandeler wrote: > > On Thu, 17 May 2018 08:14:15 + > Alex Blasche wrote: > >> The naming conventions for enums state that each enum value name must repeat >> a part of the enum Type name (for

Re: [Development] Naming convention for (scoped) enums

2018-05-17 Thread Christian Kandeler
On Thu, 17 May 2018 08:14:15 + Alex Blasche wrote: > The naming conventions for enums state that each enum value name must repeat > a part of the enum Type name (for details see > https://wiki.qt.io/API_Design_Principles#Naming_Enum_Types_and_Values) > > In case

Re: [Development] Naming convention for (scoped) enums

2018-05-17 Thread Tor Arne Vestbø
> On 17 May 2018, at 10:14, Alex Blasche wrote: > > Hi, > > The naming conventions for enums state that each enum value name must repeat > a part of the enum Type name (for details see > https://wiki.qt.io/API_Design_Principles#Naming_Enum_Types_and_Values) > > In

Re: [Development] Naming convention for (scoped) enums

2018-05-17 Thread Giuseppe D'Angelo
Il 17/05/2018 10:14, Alex Blasche ha scritto: In case of scoped enums this becomes a superfluous rule as the type has to be mentioned anyway. Does anybody object to modifying the above definition by adding an exception for scoped enums where you do not have to repeat a part of the enum type

[Development] Naming convention for (scoped) enums

2018-05-17 Thread Alex Blasche
Hi, The naming conventions for enums state that each enum value name must repeat a part of the enum Type name (for details see https://wiki.qt.io/API_Design_Principles#Naming_Enum_Types_and_Values) In case of scoped enums this becomes a superfluous rule as the type has to be mentioned anyway.