-
Notifications
You must be signed in to change notification settings - Fork 116
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
"Ordinal" versus "Priority" is confusing #553
Comments
The pain point here will be the |
We could add a new default method Old config sources would work and new config sources can just define |
I am not sure I follow - |
One of the issues is that we use ordinal for |
But see also: "highest priority". Either interpretation works in English, which is of course the main problem: which interpretation is more primal? Sadly, either, depending on usage. "Ordinal", in its mathematical sense, is unambiguous: smallest number wins ("first" trumps "second"). Sadly, we've apparently redefined it in this specification. Regardless of that, the real question is: is the audience of MicroProfile Config users and MicroProfile Config-compatible configuration document authors aware of its unambiguous meaning? I'm guessing no, i.e. no matter its definition it is sufficiently technical that "ordinary people" would have to look it up. After all, MicroProfile Config itself has redefined it! So maybe it's a poor choice. To sum up: if we want something truly unambiguous that means "largest number wins" we need a new unambiguous term IMHO. So that I'm saying something constructive: other terms I can think of in this general ballpark that I've seen in other projects include "index", "rank" (HK2), "position"…but sadly these all mean "smallest number wins"! The only one I can think of right now that unambiguously means "largest number wins" is "weight". I'm sure there are others; maybe sleep on it and see if another one comes up. My two cents. |
Yes that is another source of confusion, because There are 2 issues with this:
We can define the ordinal in a For me this is a poor developer experience, we only have 3 interfaces that a consumer can implement. In two of these interfaces, we want to provide a way to order the implementations, and we use different terms / API's to provide the ordering rules. It would be interesting if we could discuss to make these more consistent. |
Agreed, the usage of Such as:
The only thing that must be decided (and consistently across whole of MP) is whether Priority is "higher wins" or "lower wins". |
Usually, with priority, the lower number wins. From the Jakarta Interceptors Spec:
From the CDI spec:
From JAX-RS spec:
From our Config Converters spec:
Which is not very clear about the behaviour. Looking into the TCK: microprofile-config/tck/src/main/java/org/eclipse/microprofile/config/tck/ConverterTest.java Lines 129 to 150 in fd76b0e
Now we see that the priority for Converter is sorted by descending order. Generally, Jakarta specs follow the rule smaller priority values is called first. Doing that change for MP Config will be a huge backwards incompatible change, so I'm not sure if we should do it, but maybe we need to consider it. Considering that we already redefine how priority behaves with |
The above statement is only about invocation order not about which wins. In CDI spec: All the beans left are alternatives with a priority, or producer methods or fields of beans that are alternatives with a priority, then the container will determine the highest priority value, and eliminate all beans, except for alternatives with the highest priority and producer methods and fields of alternatives with the highest priority value. If there is exactly one bean remaining, the container will select this bean, and the ambiguous dependency is called resolvable. It clearly specifies the highest priority wins, which is the behaviour we are having here as well. |
Describe the bug
For
ConfigSource
we talk about "ordinal", which is a word that means "relating to position in a series", for example (first, second, third, etc.). For other things we use "priority" (and the@Priority
annotation). This is very confusing because when we talk about ordinals in language, the thing that is first is first, but we're now treatingConfigSource
ordinality the reverse way: higher (or later) ordinals take effect over lower (or earlier) ordinals.We should change all specification language referring to "ordinal" to say "priority" instead. We should also look into using
@Priority
forConfigSource
by default (possibly as a follow-up issue).The text was updated successfully, but these errors were encountered: