Expronicon.jl
Expronicon.jl copied to clipboard
Support $ interpolation when parsing docstrings for JLFunction
julia> :("foo")
"foo"
julia> bar = 42
42
julia> :("foo $bar")
:("foo $(bar)")
julia> dump(ans)
Expr
head: Symbol string
args: Array{Any}((2,))
1: String "foo "
2: Symbol bar
julia> ex = quote
"foo $bar"
f(x) = x+1
end;
julia> JLFunction(ex)
ERROR: MethodError: Cannot `convert` an object of type Expr to an object of type String
How to do that? We can simply change doc::Maybe{String}
to doc::Maybe{Union{String, Expr}}
.