[Development] Proposing to change https://wiki.qt.io/API_Design_Principles#Enums_in_classes to require scoped enums
Thiago Macieira
thiago.macieira at intel.com
Thu Jan 16 16:34:15 CET 2025
On Thursday 16 January 2025 07:13:50 Pacific Standard Time Mathias Hasselmann
via Development wrote:
> Do you really propose that we write
> QRegularExpression::PatternOption::UseUnicodePropertiesOption in the
> future? That's an identifier of 61 characters length. Considering my
> thoughts about such identifiers is left exercise to the reader.
I think it's a given that you wouldn't repeat "Option" in the enum name. We
use them today to be clear the enums are from the same set, when multiple
enums appear in one scope. With scoped enums, we don't need that, so we must
use a different naming scheme.
So I don't mind that the API review for *new* enums suggest that they be
scoped, if it's possible. For example, for QSaveFile right now, we are looking
at QSaveFile::Option::AllowDirectWriteFallback and DontFollowSymlinks. An
unscoped enum would simply move the "Option" from the middle to the end, with
little space saved.
But at this point I am not in favour of mandating them for all new
enumerations. There are still too many cases where they don't make sense. And
we definitely are not in a place to suggest that they be the only solution come
Qt 7.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Principal Engineer - Intel DCAI Platform & System Engineering
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5152 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20250116/192c44a2/attachment.bin>
More information about the Development
mailing list