TuringLang / AbstractPPL.jl

Common types and interfaces for probabilistic programming
http://turinglang.org/AbstractPPL.jl/
MIT License
27 stars 7 forks source link

Use `repr` for pretty printing indices #50

Closed phipsgabler closed 2 years ago

phipsgabler commented 2 years ago

Currently, except for the special case :, string is used to print indices. I think we should use repr instead, because:

julia> @varname(x[:a])
x[a]

julia> string(:a)
"a"

julia> repr(:a)
":a"

I think x[a] is a misrepresentation.

From the docs:

Note that repr(x) is usually similar to how the value of x would be entered in Julia.

torfjelde commented 2 years ago

Haha, I just noticed this yesterday too when noting the bug in the PR and meant to make a PR today replacing it with repr :sweat: