NotMacro
NotMacro exports @not
which can be used instead of the negation operator !
to make
code easier to read. The syntax is borrowed from Python and will feel much more intuitive
for Python users.
There is no performance penalty when using @not
, it just compiles to plain !
.
julia> using NotMacro
julia> if @not isodd(2) && @not iseven(3) && true
println("works")
end
works
julia> @macroexpand if @not isodd(2) & @not iseven(3) & true
println("works")
end
:(if (!)(isodd(2)) & ((!)(iseven(3)) & true)
#= none:2 =#
println("works")
end)