OK, I've got a solution with both assert and enforce, and the --assertions
switch working (with all uses of assert replaced with enforce in base, but
nowhere else). My version of the specific assert is now:
assert(x) = useassertions() ? enforce(x) : nothing
macro assert(ex,msgs...)
if useassertions()
:(@enforce(($ex),($msgs)...))
else
:nothing
end
end
It seems to work, though I'm not sure I got the quoting/unquoting right (or
if it's redundant). Seemed necessary to do it like this…? Should I polish
this and make a pull request? I guess polishing would include an update to
the docs and manpage, at least. Also, I didn't find any tests for assert –
just a use of assert() rather than @test in test/core.jl :-} I don't know
if I should add tests for this? If so, where? (Testing the command-line
switches would be a bit clunky.)