function foo()
x = 1
if x < 1
println("less than 1")
println(bar)
else
println("greater than or equal to 1")
end
end
foo()
the result is
greater than or equal to 1
unless of course you set x=0 then you get
less than 1
ERROR: LoadError: UndefVarError: bar not defined
in foo() at /home/nfs4/briand/src/julia/jcap/test.jl:5
in include_from_node1(::String) at ./loading.jl:488
in process_options(::Base.JLOptions) at ./client.jl:262
in _start() at ./client.jl:318
while loading /home/nfs4/briand/src/julia/jcap/test.jl, in expression starting on line 11
is there a magic switch to make the compiler try harder?
you can’t write robust code if you actually have to wait for that if clause to actually execute before catching that error.