Verona spec: $PRE comparison

Magnus Ihse Bursie magnus.ihse.bursie at oracle.com
Fri Aug 21 13:17:36 UTC 2015


On 2015-08-21 07:10, Iris Clark wrote:
> Hi.
>
> We need to declare precedence when comparing numeric and non-numeric $PRE identifiers.  The present mixed numerical/lexicographical comparison is non-transitive and will produce unexpected results.  Consider the following three values of $PRE:  "4", "2A", and "12" which produces the cycle: 4 > 2A > 12 > 4.
>
> To address this problem while still aligning with semver.org, we should follow their lead and declare a comparison precedence.  The following sentence will be added to the end of the $PRE comparison paragraph:
>
>>      Numeric identifiers have lower precedence than non-numeric identifiers.
> In the previous example we now have the following: 2A > 12 > 4.

But that's still weird, isn't it?

Sorting "2", "3" and "2-beta" anything else than "2", "2-beta" and "3" 
seems very surprising to me. And even if the intention is to allow 
numerical comparison with numbers (so 1, 2, and 10 is sorted in that 
order), this will nevertheless break down if a non-numerical character 
is introduced, e.g. "beta-1", "beta-2" and "beta-10" will not be sorted 
numerical anyway.

I strongly suggest that the PRE field is *purely* sorted on a 
lexicographical order. I believe that is the only way to achieve a sound 
sorting order.

/Magnus


More information about the verona-dev mailing list