Skip to content

Commit 62403b9

Browse files
committed
Change BasicSymbolic types to mutable due to Julia finalizer
to support `WeakValueDict`
1 parent e9e702b commit 62403b9

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/types.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,38 +23,38 @@ const EMPTY_DICT = sdict()
2323
const EMPTY_DICT_T = typeof(EMPTY_DICT)
2424

2525
@compactify show_methods=false begin
26-
@abstract struct BasicSymbolic{T} <: Symbolic{T}
26+
@abstract mutable struct BasicSymbolic{T} <: Symbolic{T}
2727
metadata::Metadata = NO_METADATA
2828
end
29-
struct Sym{T} <: BasicSymbolic{T}
29+
mutable struct Sym{T} <: BasicSymbolic{T}
3030
name::Symbol = :OOF
3131
end
32-
struct Term{T} <: BasicSymbolic{T}
32+
mutable struct Term{T} <: BasicSymbolic{T}
3333
f::Any = identity # base/num if Pow; issorted if Add/Dict
3434
arguments::Vector{Any} = EMPTY_ARGS
3535
hash::RefValue{UInt} = EMPTY_HASH
3636
end
37-
struct Mul{T} <: BasicSymbolic{T}
37+
mutable struct Mul{T} <: BasicSymbolic{T}
3838
coeff::Any = 0 # exp/den if Pow
3939
dict::EMPTY_DICT_T = EMPTY_DICT
4040
hash::RefValue{UInt} = EMPTY_HASH
4141
arguments::Vector{Any} = EMPTY_ARGS
4242
issorted::RefValue{Bool} = NOT_SORTED
4343
end
44-
struct Add{T} <: BasicSymbolic{T}
44+
mutable struct Add{T} <: BasicSymbolic{T}
4545
coeff::Any = 0 # exp/den if Pow
4646
dict::EMPTY_DICT_T = EMPTY_DICT
4747
hash::RefValue{UInt} = EMPTY_HASH
4848
arguments::Vector{Any} = EMPTY_ARGS
4949
issorted::RefValue{Bool} = NOT_SORTED
5050
end
51-
struct Div{T} <: BasicSymbolic{T}
51+
mutable struct Div{T} <: BasicSymbolic{T}
5252
num::Any = 1
5353
den::Any = 1
5454
simplified::Bool = false
5555
arguments::Vector{Any} = EMPTY_ARGS
5656
end
57-
struct Pow{T} <: BasicSymbolic{T}
57+
mutable struct Pow{T} <: BasicSymbolic{T}
5858
base::Any = 1
5959
exp::Any = 1
6060
arguments::Vector{Any} = EMPTY_ARGS

0 commit comments

Comments
 (0)