I seem to recall that its possible to remove all must_be and friends from the code during compilation using a switch – i couldn’t find it in the documentation.
Do i recall this correct? If yes, what is the switch?
thanks
Dan
I seem to recall that its possible to remove all must_be and friends from the code during compilation using a switch – i couldn’t find it in the documentation.
Do i recall this correct? If yes, what is the switch?
thanks
Dan
Not sure, but could you be somehow mixing this up with assertion/1 from library(debug)?
Perhaps, but i seem to recall that must_be/2 can also be removed from compile – i may of course recall incorrectly.
My understanding is that must_be/2 and altogether library(error) is meant to do exactly that: do run-time checks and make it easier to throw the correct error.
I see.
I thought its a development / debug aid.
But, perhaps i should use assert instead of must_be – i guess, my intent is then better covered by assertion
On the other hand – i don’t want the debugger to get started, since i want to trap exceptions during unit test run as well.
A simple solution is
goal_expansion(must_be(_,_), true).
I guess, I could do this for all such test code - to wrap them all into aux_must_be/1 – which can alternatively be expanded to true.
e.g. must_be is only one example, somtimes I want a goal failure to cause an exception during debug time and during testing.