Skip to content

Commit 256c6ad

Browse files
authored
Update size/length workaround recommendation
1 parent 44d2349 commit 256c6ad

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,24 @@ julia> y[-1,-7,-128,-5,-1,-3,-2,-1] += 5
2323
Support for such arrays is based on new functionality in Julia v0.5,
2424
and the modern package is not usable on earlier Julia versions.
2525

26-
## Special note for Julia 0.5
26+
## Special note for Julia 0.7
2727

28-
During the transition during Julia 0.5 to allowing arrays with
28+
During the transition to allowing arrays with
2929
arbitrary indices, certain operations (like `size` and `length`) are
3030
deliberately unsupported; see the
3131
[documentation](http://docs.julialang.org/en/latest/devdocs/offset-arrays/)
3232
describing the reasoning behind this decision. The general
33-
recommendation is to use `indices` and `linearindices` for most
33+
recommendation is to use iteration and `eachindex` and `LinearIndices` for most
3434
operations where `size` and `length` would have formerly been used.
3535

3636
If your package makes use of OffsetArrays, you can also add the
3737
following internal convenience definitions:
3838

3939
```jl
40-
_size(A::AbstractArray) = map(length, indices(A))
40+
_size(A::AbstractArray) = size(LinearIndices(A))
4141
_size(A) = size(A)
4242

43-
_length(A::AbstractArray) = length(linearindices(A))
43+
_length(A::AbstractArray) = length(LinearIndices(A))
4444
_length(A) = length(A)
4545
```
4646

0 commit comments

Comments
 (0)