We could test your “lemma”:
julia> if get(ENV, "debug", "0") != "0"
macro check(a) :(if !$(esc(a)) throw(ErrorException("ups!")) end) end
else
macro check(a) end
end
t = 4
for i in 1:2
@check ispow2(t) # I want to check only in debug phase
t = 16
end
t
4
now we could define env variable ENV["debug"]="1"
and repeat same sequence.