I came across this implementing the rotational cipher in exercism with the very nice help of @tomerarnon. The help for @eval
states:
@eval [mod,] ex
Evaluate an expression with values interpolated into it using eval. […]
Not knowing what an expression is I looked into the Julia docs for expressions and evaluation where my interpretation is that an expression has the form
quote
CODE
end
However, @eval
evaluates
@eval CODE
rather than
@eval quote
CODE
end
To give an example
name = "pln"
@eval quote
function $(Symbol(name))(txt)
println(txt)
end
end
returns a quoted version which can be passed to eval
to evaluate
name = "pln"
@eval function $(Symbol(name))(txt)
println(txt)
end
creates the function pln
as expected.
I am not fully clear on what the type of CODE
is. Is that also an expression even though it is not quoted?