From f41a741f829857e193244f1b6de6b20e41945313 Mon Sep 17 00:00:00 2001 From: adrhill Date: Wed, 16 Oct 2024 16:52:27 +0200 Subject: [PATCH 1/4] Mark `has_offset_axes` and `require_one_based_indexing` as public --- base/public.jl | 4 ++++ 1 file changed, 4 insertions(+) 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, From a3996b9390bbd530a5b8fa94635d1d7d114f4c2b Mon Sep 17 00:00:00 2001 From: adrhill Date: Thu, 17 Oct 2024 16:09:37 +0200 Subject: [PATCH 2/4] Update docs --- doc/src/base/arrays.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/src/base/arrays.md b/doc/src/base/arrays.md index 66fe5c78f1ee6..5f87801d15fdd 100644 --- a/doc/src/base/arrays.md +++ b/doc/src/base/arrays.md @@ -115,6 +115,12 @@ Base.checkindex Base.elsize ``` +The following functions can be used to handle arrays with custom indices: +```@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 From 11033fd63a93419dee4096a168ce10770a071dd9 Mon Sep 17 00:00:00 2001 From: adrhill Date: Mon, 21 Oct 2024 13:36:46 +0200 Subject: [PATCH 3/4] Update NEWS.md --- NEWS.md | 1 + 1 file changed, 1 insertion(+) 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 From 24a64d34e2c67477a9ebb7cb3339fa7e284c4aba Mon Sep 17 00:00:00 2001 From: Adrian Hill Date: Mon, 21 Oct 2024 19:53:42 +0200 Subject: [PATCH 4/4] Update docs with reference to `eachindex` Co-authored-by: Matt Bauman --- doc/src/base/arrays.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/base/arrays.md b/doc/src/base/arrays.md index 5f87801d15fdd..defe497daf00c 100644 --- a/doc/src/base/arrays.md +++ b/doc/src/base/arrays.md @@ -115,7 +115,7 @@ Base.checkindex Base.elsize ``` -The following functions can be used to handle arrays with custom indices: +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