As far as I can tell, there’s no need for @toggle
to be a macro–it can just be a function:
function toggle(enable::Bool)
lock(toggle_lock) do
@eval ToggleableAsserts assert_toggle() = $enable
on_or_off = enable ? "on." : "off."
@info "Toggleable asserts turned "*on_or_off
end
end
There’s nothing wrong with using a macro, but it’s an unnecessary layer of complexity.