Consider
function foo(x)
x isa Bar || throw(ArgumentError("x is not a Int64..."))
dosomething(x)
end
as opposed to a traditional
function foo(x)
if !(x isa Bar)
throw(ArgumentError("x is not a Bar..."))
end
dosomething(x)
end
(functionally equivalent is !(x isa Int64) && ...
) Poking around a few packages, it seems this sort of conditional evaluation is not popular -- at face value, it seems convenient, and I prefer it a bit stylistically.
Is there a consensus on this stylistically? I understand that using the Unicode \in is discouraged over the word "in" by at least the Blue style guide for the sake of readability/ compatibility -- is this something similar?
Is this less performant? At face value, it seems like it would take about the same number of operations. I came across this post as well, but the answers aren't very satisfying, even ignoring that it's now likely outdated.