I’m in Julia v0.7.
using JuMP
m = Model()
@variable(m, x)
#1
@NLconstraint(m, x == 0)
#2
e2 = :(@NLconstraint(m, x == 0))
eval(e2)
#3
e3 = Expr(:macrocall, Symbol("@NLconstraint"), :m, :(x==0))
eval(e3)
#4
sub_e = Expr(:call, :(==), :x, 0)
e4 = Expr(:macrocall, Symbol("@NLconstraint"), :m, sub_e)
eval(e4)
In the above, #1 and #2 produce the same result, but #3 creates an error. As I examined
julia> e2.args
4-element Array{Any,1}:
Symbol("@NLconstraint")
:(#= REPL[124]:2 =#)
:m
:(x == 0)
I see :(#= REPL[124]:2 =#)
. What is this? How should I modify #3? Can I make #4 also work?