Open
Description
Julia’s current prerelease tags (-beta1
, -rc1
, etc.) don't utilize the structured prerelease fields of VersionNumber
. Instead of, e.g., -beta1
, it should really be -beta.1
.
Here is what gets stored inside the VersionNumber
struct for 1.12.0-beta4
, compared to -beta.4
:
julia> VERSION |> dump
VersionNumber
major: UInt32 0x00000001
minor: UInt32 0x0000000c
patch: UInt32 0x00000000
prerelease: Tuple{String}
1: String "beta4"
build: Tuple{} ()
julia> v"1.12.0-beta.4" |> dump
VersionNumber
major: UInt32 0x00000001
minor: UInt32 0x0000000c
patch: UInt32 0x00000000
prerelease: Tuple{String, UInt64}
1: String "beta"
2: UInt64 0x0000000000000004
build: Tuple{} ()
This means that prerelease versions are ordered lexically as strings, causing unintuitive ordering once double-digit suffixes appear:
julia> v"1.12.0-beta10" > v"1.12.0-beta2"
false
In contrast, using Tuple{String,UInt64}
format avoids this issue:
julia> v"1.12.0-beta.10" > v"1.12.0-beta.2"
true
Thanks to @giordano's post here for explaining this subtlety: https://discourse.julialang.org/t/can-we-have-pre-release-versions-in-the-registry-v2/129887/2?u=milescranmer
Metadata
Metadata
Assignees
Labels
No labels