-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Key metadata improvements #14022
base: 2.5
Are you sure you want to change the base?
Key metadata improvements #14022
Conversation
…like tuning ore advanced modes we cannot parse.
Rebased to resolve conflicts. |
enum class [[nodiscard]] UpdateResult{ | ||
/// The value has been updated and changed. | ||
Updated, | ||
enum class UpdateResult { | ||
/// The value has been updated and changed. | ||
Updated, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This tells me that the enum was deliberately made for error handling. Specifically Rejected
should be checked because it almost always would require handling from the caller. This removes that feature, making the error checking optional (which I hope we can agree is very bad practice).
I need more explanation why its appropriate to weaken the guarantees this enum was supposed to provide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concretely: What is your rationale for removing the checks you removed in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have discussed this earlier and conclude that [[nodiscard]]
is usefull if discarding is an error. In this case it is only an enum. Discarding can't be an error. It might be an error depending on the returning function. In our case it is updateGlobalKeyNormalizeText()
wich works well without error checking. So the change allows us to remove static_cast<void>()
on these calls. See at dlgtrackinfomulti.cpp
The counter example are places like this where [[nodiscard]]
heps to avois programming errors:
mixxx/src/util/compatibility/qmutex.h
Line 32 in a4e61f9
[[nodiscard]] inline QT_MUTEX_LOCKER lockMutex(QMutex* pMutex) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case it is only an enum. Discarding can't be an error.
Is it though? It seems that Rejected
and Unchanged
did need some special handling in some cases (which you have removed). I'm asking specifically why its fine to remove the handling for those cases here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so. I have left an inline comment:
#14022 (comment)
m_trackRecord.updateGlobalKeyNormalizeText( | ||
keyText, | ||
mixxx::track::io::key::USER); | ||
displayKeyText(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we need to call displayKeyText()
independent of the result of updateGlobalKeyNormalizeText()
because we either want to see the normalized value or the old.
These are the leftover commits form the key metadata handling PRs for #10890
They do not fix anything, but make the code more consistent.