Hi Tor Arne,

On 16.01.25 12:31, Tor Arne Vestbø wrote:
> 
>> On Jan 16, 2025, at 11:56, Marc Mutz via Development 
>> <development@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.

I don't. You just snipped that part of the email ;)

> -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?

We as in the Qt project, having given us 
https://wiki.qt.io/API_Design_Principles, which reads

 > Readable code may sometimes take longer to write, but saves time
 > throughout the product's life cycle.

(in https://wiki.qt.io/API_Design_Principles#Lead_to_readable_code)

IOW: readability trumps brevity

> 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::”)

I find the repetition comforting, reassuring me that the LHS and RHS 
match in semantics.

The question remains, though, how far we should go to sacrifice the objective 
technical benefits of using scoped enums for a (subjective) notion of 
readability?

Maybe have a second look at my suggestion to use scoped enums, but then 
break the scope with (the equivalent of) `using enum`? I think that 
might be a good compromise.

Thanks,
Marc

-- 
Marc Mutz <marc.m...@qt.io> (he/his)
Principal Software Engineer

The Qt Company
Erich-Thilo-Str. 10 12489
Berlin, Germany
www.qt.io

Geschäftsführer: Mika Pälsi, Juha Varelius, Jouni Lintunen
Sitz der Gesellschaft: Berlin,
Registergericht: Amtsgericht Charlottenburg,
HRB 144331 B

-- 
Development mailing list
Development@qt-project.org
https://lists.qt-project.org/listinfo/development

Reply via email to