Skip to content

Commit 087d306

Browse files
committed
is_dynamic -> can_change_size
Also update docstring to reflect this change
1 parent aafaf7c commit 087d306

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ and exported in a future Base Julia there will be no issues with the upgrade.
1515

1616
Returns the parent array that `x` wraps.
1717

18-
## is_dynamic(x)
18+
## can_change_size(x)
1919

20-
Returns `true` if the size of `T` is dynamic. If `T` is dynamic then operations
20+
Returns `true` if the size of `T` can change, in which case operations
2121
such as `pop!` and `popfirst!` are available for collections of type `T`.
2222

2323
## ismutable(x)

src/ArrayInterface.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ parent_type(::Type{<:LinearAlgebra.AbstractTriangular{T,S}}) where {T,S} = S
2323
parent_type(::Type{T}) where {T} = T
2424

2525
"""
26-
is_dynamic(::Type{T}) -> Bool
26+
can_change_size(::Type{T}) -> Bool
2727
28-
Returns `true` if the size of `T` is dynamic. If `T` is dynamic then operations
28+
Returns `true` if the size of `T` can change, in which case operations
2929
such as `pop!` and `popfirst!` are available for collections of type `T`.
3030
"""
31-
is_dynamic(x) = is_dynamic(typeof(x))
32-
is_dynamic(::Type{T}) where {T} = false
33-
is_dynamic(::Type{<:Vector}) = true
34-
is_dynamic(::Type{<:AbstractDict}) = true
35-
is_dynamic(::Type{<:Base.ImmutableDict}) = false
31+
can_change_size(x) = can_change_size(typeof(x))
32+
can_change_size(::Type{T}) where {T} = false
33+
can_change_size(::Type{<:Vector}) = true
34+
can_change_size(::Type{<:AbstractDict}) = true
35+
can_change_size(::Type{<:Base.ImmutableDict}) = false
3636

3737
function ismutable end
3838

test/runtests.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,11 @@ end
188188
@test isone(ArrayInterface.known_step(typeof(1:4)))
189189
end
190190

191-
@testset "is_dynamic" begin
192-
@test ArrayInterface.is_dynamic([1])
193-
@test ArrayInterface.is_dynamic(Vector{Int})
194-
@test ArrayInterface.is_dynamic(Dict{Symbol,Any})
195-
@test !ArrayInterface.is_dynamic(Base.ImmutableDict{Symbol,Int64})
196-
@test !ArrayInterface.is_dynamic(Tuple{})
191+
@testset "can_change_size" begin
192+
@test ArrayInterface.can_change_size([1])
193+
@test ArrayInterface.can_change_size(Vector{Int})
194+
@test ArrayInterface.can_change_size(Dict{Symbol,Any})
195+
@test !ArrayInterface.can_change_size(Base.ImmutableDict{Symbol,Int64})
196+
@test !ArrayInterface.can_change_size(Tuple{})
197197
end
198198

0 commit comments

Comments
 (0)