Skip to content

Commit 2b3c486

Browse files
authored
Update src/StructTypes.jl
1 parent 04e3aeb commit 2b3c486

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/StructTypes.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,8 @@ Base.haskey(s::SubTypeClosure, k::Symbol) = haskey(s._subtypes, k)
580580
Base.get(s::SubTypeClosure, k::Symbol, default) = get(s._subtypes, k, s.f(k))
581581
Base.getindex(s::SubTypeClosure, k::Symbol) = get!(s, k, s.f(k))
582582
Base.get!(s::SubTypeClosure, k::Symbol, default) = get!(s._subtypes, k, s.f(k))
583+
# we hard-code length here because we still want to fulfill AbstractDict interface
584+
# but our closure approach is "lazy" in that we don't know subtypes until they're encountered
583585
Base.length(s::SubTypeClosure) = typemax(Int)
584586
Base.keys(s::SubTypeClosure) = keys(s._subtypes)
585587
Base.values(s::SubTypeClosure) = values(s._subtypes)

0 commit comments

Comments
 (0)