How to represent a value as a syntactically correct string

Hello, how to represent a simple value as a syntactically correct string?

for example, this is i do

represent(s::Symbol)::String = "Symbol(\"$s\")" 
represent(:abc)  # -> "Symbol("abs")" 
# but have a bug
Symbol("\\\"a") != @eval $(Meta.parse(represent(Symbol("\\\"a"))))

repr does what you want, on most built-in types at least.

2 Likes