[Development] Proposing to change https://wiki.qt.io/API_Design_Principles#Enums_in_classes to require scoped enums

Tor Arne Vestbø Tor.arne.Vestbo at qt.io
Thu Jan 16 12:31:30 CET 2025


> On Jan 16, 2025, at 11:56, Marc Mutz via Development <development at qt-project.org> wrote:
> 
> Like every API review, so also in 6.9, we have the discussions between 
> proponents of scoped vs. unscoped enums in class scope.

Indicating that it’s still a nuanced issue where each case might have different considerations and preferences.

> Can we, please, settle this by strengthening the wording of 
> https://wiki.qt.io/API_Design_Principles#Enums_in_classes to something 
> that requires scoped enums?

Yet your proposal is to ignore those nuances. 

-1

> is a very _un_-Qt-ish one. In Qt, we believe that brevity does not 
> automatically equal readability¹, and the more explicit
> 
>> if (point.state() == TouchPoint::State::Pressed)
> 
> is more (but certainly not less) readable than
> 
>> if (point.state() == TouchPoint::Pressed)

Who is “we” here? I for one would not agree with what you wrote above, so there’s your data point.

The latter is more readable to me due to lack of redundant information (“State::”)

Cheers,
Tor Arne




More information about the Development mailing list