Don't use enums for default values #2066
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR type: bugfix
Related issue(s)/PRs: related to 1985
Summary
Proposed changes
The wrapper for config constants is implemented as an Enum, even though it's not really being used as an enumeration. More problematically, Enums don't work correctly when two members have the same value and result in an alias for the first entry. The PR 1985 has this issue since both
LIKELIHOODS_POSITIVE_MINIMUMandJITTERhave the value1e-6.As proposed by this PR, we simply stop making the wrapper an enum. This forces us to explicitly state the environment variable names alongside the default values, but this duplication is not necessarily a bad thing.
What alternatives have you considered?
We could use an external enum package such as
aenumthat does support duplicate entries, but this introduces an unnecessary package dependency to GPflow.Minimal working example
Release notes
Fully backwards compatible: yes
PR checklist
make format)make check-all)