When being call with (func (some 1)), it will return 1 but the print of the right branch will be evaluated and printed.
It does make sense because functions arguments are always evaluated before calling the function itself (eg: foo(3, bar())). But in this case, I think it should behave differently. Only one of the branch should be evaluated depending on the condition. Like if and asserts!
In Clarity 1 and 2, both branches of
unwrap!
andunwrap-err!
statements are always evaluated.Consider the following
must-be-some
function:When being call with
(func (some 1))
, it will return1
but the print of the right branch will be evaluated and printed.It does make sense because functions arguments are always evaluated before calling the function itself (eg:
foo(3, bar())
). But in this case, I think it should behave differently. Only one of the branch should be evaluated depending on the condition. Likeif
andasserts!
It will have an impact on code coverage as well