I’m fairly new to Julia (my main language is Python). I’m struggling with a problem that is probably pretty basic with regard to macro usage. I’m on Julia 0.6.2.
In particular for the
@. macro, if I run:
@. x = (abs([1 2 3]) <= 1)
I get a
ERROR: UndefVarError: x not defined. If x is defined before, this runs fine. Is it a well-know fact that the assigned variable needs to be predeclared for using with
I’ve found seamingly related questions on StackOverflow (Broken macro functionality in Julia v0.6 and Julia macro expansion inside function) and a PR 15850 about a change of “macro hygiene” in 0.6 that generated similar
UndefVarError errors in various modules. But in the end, I cannot relate these to my problem.
Thanks for your kind help.