Open njordhov opened 4 years ago
It could be named asserts-panic
, or asserts-abort
as proposed in #25
It could be named asserts-panic, or asserts-abort
Extra verbosity not required as just assert
is widely recognized for this functionality.
Clarity should have an
assert
construct that aborts the contract call when an invariant predicate is false.Assertions are common in programming languages, including other Lisp dialects: Clojure has assert; Common Lisp has assert; Scheme has assert; Typed Racket has with-asserts;
Clarity already have an
asserts!
form, but instead of aborting the contract call, it returns an error from the current function. This is a foot gun for Clarity developers, inviting security flaws such as failing to handle severe errors. It is also inflexible, limiting assertions to functions that return a result type.