You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make DefaultStable and DefaultUnstable dispatchable and display without internals (#56661)
Previously, `DEFAULT_STABLE` was a giant chain of algorithms reflecting
the full sorting dispatch system. Now, it's simply `DefaultStable()`.
This has a few minor impacts:
Previously, the public binding `Base.Sort.DEFAULT_STABLE` documented
non-public implementation details of sorting dispatch in its extended
help with a caviat that they are internal. Now,
`Base.Sort.DEFAULT_STABLE` refers to the non-public binding
`Base.Sort.DefaultStable` and implementation details are documented
there with a warning that they are non-public.
Previously, dispatching on `Base.Sort.DEFAULT_STABLE` required writing
`::typeof(Base.Sort.DEFAULT_STABLE)` whereas now one could alternatively
dispatch on the (internal) type `Base.Sort.DefaultStable`.
Previously `Base.Sort.DEFAULT_STABLE === Base.Sort.DEFAULT_UNSTABLE` so
when writing sorting algorithms for custom collections it was impossible
to determine if the user asked for a stable algorithm. Now
`DEFAULT_STABLE` is `DefaultStable()` and `DEFAULT_UNSTABLE` is
`DefaultUnstable()`. Both the algorithms expand to the same large chain
of algorithms `_DEFAULT_ALGORITHMS_FOR_VECTORS` but it is possible to
intercept them before that happens.
`Base.Sort.DEFAULT_STABLE` now prints as `DefaultStable()` instead of
```julia-repl
julia> Base.Sort.DEFAULT_STABLE
Base.Sort.SubArrayOptimization(
Base.Sort.MissingOptimization(
Base.Sort.BoolOptimization(
Base.Sort.Small{10}(
Base.Sort.InsertionSortAlg(),
Base.Sort.IEEEFloatOptimization(
Base.Sort.IsUIntMappable(
Base.Sort.Small{40}(
Base.Sort.InsertionSortAlg(),
Base.Sort.CheckSorted(
Base.Sort.ComputeExtrema(
Base.Sort.ConsiderCountingSort(
Base.Sort.CountingSort(),
Base.Sort.ConsiderRadixSort(
Base.Sort.RadixSort(),
Base.Sort.Small{80}(
Base.Sort.InsertionSortAlg(),
Base.Sort.ScratchQuickSort(missing, missing,
Base.Sort.InsertionSortAlg()))))))),
Base.Sort.StableCheckSorted(
Base.Sort.ScratchQuickSort(missing, missing,
Base.Sort.InsertionSortAlg()))))))))
```
Factored out of #54494 at Triage's request (the git history reflects
this history).
---------
Co-authored-by: Lars Göttgens <[email protected]>
0 commit comments