Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

key type of SimpleVarInfo is underfined #791

Open
mhauru opened this issue Jan 28, 2025 · 0 comments
Open

key type of SimpleVarInfo is underfined #791

mhauru opened this issue Jan 28, 2025 · 0 comments

Comments

@mhauru
Copy link
Member

mhauru commented Jan 28, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant