Skip to content

Commit b4ef240

Browse files
More complex ismutable
1 parent bf66226 commit b4ef240

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/ArrayInterface.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ module ArrayInterface
33
using Requires
44

55
function ismutable end
6+
7+
"""
8+
ismutable(x::DataType)
9+
10+
Query whether a type is mutable or not, see
11+
https://github.com/JuliaDiffEq/RecursiveArrayTools.jl/issues/19.
12+
"""
13+
Base.@pure ismutable(x::DataType) = x.mutable
14+
615
ismutable(x::Array) = true
716

817

@@ -16,6 +25,10 @@ function __init__()
1625
@require LabelledArrays="2ee39098-c373-598a-b85f-a56591580800" begin
1726
ismutable(x::LVector) = ismutable(x.__x)
1827
end
28+
29+
@require Flux="587475ba-b771-5e3f-ad9e-33799f191a9c" begin
30+
ismutable(x::Flux.Tracker.TrackedArray) = false
31+
end
1932
end
2033

2134
end

0 commit comments

Comments
 (0)