The only
example makes me think the idea should be to give the proof of the error condition.
For only
, we need to prove it has 2 elements, no more.
It would be nice to have a Base function abbreviated_type
to use in error messages.
In another post I tried Elm style errors, and Mason came up with a macro to use like
function f(x::Real)
if x>= 0.0
x + 1
else
@noinline_block x throw(DomainError("f requires inputs greater than 0, you gave $x which is less than 0"))
end
end