Thanks all, I agree unit tests would be helpful for understanding the
intended behavior.

Secondly, I adjusted my "reply-to" in my gmail settings; hopefully this
resolves the reply-to issue.

Lastly, there are two regrettably lengthy follow-ups below that relate to
handling versions like "-1" (hyphen as initial token); if these are
clarified I can take a stab at some PRs for both the spec and
maven-artifact code to close this out.

----
Trimming "---1"

Trimming and tokenization are substantial sections of the version spec and
factor into the version comparison logic depending on their semantics, so
I'm not sure they can be disregarded when considering the spec.

The sentence <https://maven.apache.org/pom.html#Version_Order_Specification>
"this process is repeated at each remaining hyphen from end to start"
implies that "---1" and "-1" should be equivalent.  Is this understanding
correct?

----
Versions that Start with Hyphen


I'm still unsure of the correct behavior w/r/t the spec when the initial
character is a hyphen.  Some ideas I had:

(1) is not trimming the initial null value.  Then versions with an initial
hyphen would have a "0-" prefix when performing comparison (` Empty tokens
are replaced with "0" `).  If the padding understanding is incorrect please
let me know.  This leads to the potentially unintuitive result that "alpha"
< "-alpha" instead of "alpha" = "-alpha"

Examples:

"-foo" -> "0-foo"
"-123" -> "0-123"

Example comparisons of interest:

"foo" < "-foo"            // "foo" < "0" because nonnumeric qualifiers are
less than numeric qualifiers
"alpha" < "-alpha"    // "alpha" < "0" similar to above except special
qualifiers are less than numeric qualifiers


(2) is treating versions as having an initial number.  Intuitively, an
initial numeric token (that's not trimmed) would make the most sense
because versions are generally numeric in nature.  If the initial token is
not a number, the initial numeric token would be 0.  You don't say "this is
version alpha" without understanding that this would be the initial alpha
release, e.g. "0-alpha".

Sure, there may be software projects that use solely nun-numeric versioning
schemes like the greek alphabet; in which case "alpha" may refer to the one
and only "alpha" release, but this would be the exception (the "odd duck",
bless that developer) and hopefully not the rule.

Examples for the initial number proposal:

foo -> 0-foo       // transition between numbers and characters is
equivalent to "-", "-foo" = "foo"
.alpha -> 0.alpha
-1 -> 0-1          // 0 value not trimmed

(3) is trimming the initial null values that don't have a separator.  In
this case, the three versions would be equivalent: "--1" = "-1" = "1".
This is a bit unintuitive, since "-1" implies some sort of prerelease or
revision of the "0" version as noted in idea (1).

----

Hope this makes sense, thanks again for the time.

Best,
Ron

On Sat, Aug 9, 2025 at 9:16 AM Elliotte Rusty Harold <elh...@ibiblio.org>
wrote:

> > So to recap, had three questions:
> >
> > 1) should versions be treated as if there's an implicit separator?
> > 2) how should trimming/tokenization work for "--1--" and "--1-"?
> > 3) how should trimming/tokenization work for "abc" and "-abc"?
>
>
> Trimming and tokenization are implementation details and are not
> guaranteed. What's guaranteed is how version strings compare to each
> other. If you ask how two specific version strings compare to each
> other, then the spec should answer your question. If it doesn't,
> that's a spec bug.
>
>
> --
> Elliotte Rusty Harold
> elh...@ibiblio.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

Reply via email to