-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Description
am i thinking about this wrong, or is the fact that indexing the 4th column of a buffer of length 3 does not throw an error a bug?
julia> using CircularArrayBuffers
julia> b = CircularArrayBuffer([1 2 3; 4 5 6])
CircularArrayBuffer(::Matrix{Int64}) with eltype Int64:
1 2 3
4 5 6
julia> @view b[:,4] ### !!! shouldn't this throw a BoundsError ???
2-element view(::Matrix{Int64}, :, 1) with eltype Int64:
1
4
julia> @view b[:,7] ### it finally does here once the length of the buffer has been exceeded
ERROR: BoundsError: attempt to access 2×3 Matrix{Int64} at index [1:2, 4]
Stacktrace:
[1] throw_boundserror(A::Matrix{Int64}, I::Tuple{Base.Slice{Base.OneTo{Int64}}, Int64})
@ Base ./abstractarray.jl:737
[2] checkbounds
@ ./abstractarray.jl:702 [inlined]
[3] view
@ ./subarray.jl:184 [inlined]
[4] view(::CircularArrayBuffer{Int64, 2, Matrix{Int64}}, ::Function, ::Int64)
@ CircularArrayBuffers ~/.julia/dev/CircularArrayBuffers/src/CircularArrayBuffers.jl:73
[5] top-level scope
@ REPL[6]:1
(jl_gK1hOx) pkg> st
Status `/tmp/jl_gK1hOx/Project.toml`
[9de3a189] CircularArrayBuffers v0.1.12 `~/.julia/dev/CircularArrayBuffers`
julia> versioninfo()
Julia Version 1.10.2
Commit bd47eca2c8a (2024-03-01 10:14 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 64 × Intel(R) Xeon(R) CPU E5-2683 v4 @ 2.10GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, broadwell)
Threads: 1 default, 0 interactive, 1 GC (on 64 virtual cores)
Environment:
LD_LIBRARY_PATH = /misc/lsf/10.1/linux3.10-glibc2.17-x86_64/lib
JULIA_PROJECT = @.
JULIA_DEPOT_PATH = /groups/scicompsoft/home/arthurb/.julia:
Metadata
Metadata
Assignees
Labels
No labels