Is there not an ambiguity of operator : between expressions and symbols? I
am trying to create an expression that calls a function with a symbol
parameter, that comes from a string in context of the expression creator:
function f(s::Symbol)
end
f(:abc) # works
# get symbol name from a string
name = "abc"
f(symbol(name)) # works
eval(:(f(symbol(name)))) # still works
# moving over to using the context of the expression creator to specify the
symbol:
eval(:(f($(symbol("abc"))))) # nope, this generates: f(abc)
eval(:(f(:(:($(symbol("abc"))))))) # bad, generates: f(Expr)
# workaround:
eval(:(f(:($(symbol("abc")))))) # almost, but generates: f(symbol("abc"))
not f(:abc)
Is there a trick to generate a more direct expression that eval() to:
f(:abc) ?