diff --git a/NEWS.md b/NEWS.md index 9aebf5d42d954..c56a764dbccfd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -110,6 +110,7 @@ New library features the uniquing checking ([#53474]) * `RegexMatch` objects can now be used to construct `NamedTuple`s and `Dict`s ([#50988]) * `Lockable` is now exported ([#54595]) +* `Base.require_one_based_indexing` and `Base.has_offset_axes` are now public ([#56196]) * New `ltruncate`, `rtruncate` and `ctruncate` functions for truncating strings to text width, accounting for char widths ([#55351]) Standard library changes diff --git a/base/public.jl b/base/public.jl index 1a23550485d84..8777a454c920a 100644 --- a/base/public.jl +++ b/base/public.jl @@ -28,6 +28,10 @@ public acquire, release, +# arrays + has_offset_axes, + require_one_based_indexing, + # collections IteratorEltype, IteratorSize, diff --git a/doc/src/base/arrays.md b/doc/src/base/arrays.md index 66fe5c78f1ee6..defe497daf00c 100644 --- a/doc/src/base/arrays.md +++ b/doc/src/base/arrays.md @@ -115,6 +115,12 @@ Base.checkindex Base.elsize ``` +While most code can be written in an index-agnostic manner (see, e.g., [`eachindex`](@ref)), it can sometimes be useful to explicitly check for offset axes: +```@docs +Base.require_one_based_indexing +Base.has_offset_axes +``` + ## Views (SubArrays and other view types) A “view” is a data structure that acts like an array (it is a subtype of `AbstractArray`), but the underlying data is actually