Skip to content

key type of SimpleVarInfo is underfined #791

Open
@mhauru

Description

@mhauru

I think it would be reasonable to expect that collect(keys(vi)) would return a vector VarNames, but this is not always true for SimpleVarInfo. You can, in fact, make the key type be whatever you want:

julia> collect(keys(DynamicPPL.SimpleVarInfo(OrderedDict(0 => 1))))
1-element Vector{Int64}:
 0

Maybe more commonly, empty SimpleVarInfos are trouble:

julia> collect(keys(DynamicPPL.SimpleVarInfo(OrderedDict())))
Any[]

julia> collect(keys(DynamicPPL.SimpleVarInfo()))
Union{}[]

See https://github.com/TuringLang/DynamicPPL.jl/pull/780/files#r1928908281

We could just fix keys, but I wonder, as @penelopeysm says in the above comment, whether we should put more strict bounds on the values field.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions