Skip to content

Commit c2d85c3

Browse files
committed
Create flyweight factory for BasicSymbolic
1 parent 2dac2a3 commit c2d85c3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/types.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,13 @@ end
318318
### Constructors
319319
###
320320

321+
function BasicSymbolic(s::BasicSymbolic)::BasicSymbolic
322+
get!(wvd, hash2(s), s)
323+
end
324+
321325
function Sym{T}(name::Symbol; kw...) where {T}
322326
s = Sym{T}(; name, kw...)
323-
get!(wvd, hash2(s), s)
327+
BasicSymbolic(s)
324328
end
325329

326330
function Term{T}(f, args; kw...) where T

0 commit comments

Comments
 (0)