Remix.run Logo
▲ cogman10 7 hours ago

Well, except for the fact that asserts can be used during debugging to do input validation while these shouldn't be used for that. They also introduced `contract_assert` which seems to have no benefit over assert other than it's more likely to not be disabled.

▲wongarsu 6 hours ago | parent | next [-]

Asserts also shouldn't be used for input validation.

If during debugging you are peppering asserts that restate things that per the API contract should already be true, but you want to make extra sure your bug isn't caused by something slipping through the cracks: that's what what contracts are for.

▲OneDeuxTriSeiGo 7 hours ago | parent | prev [-]

nah contract_assert has entirely different semantics than normal asserts.

It includes checkpoint semantics (something that is part of contracts in general) as well as processing through the contract violation handlers.

Functionally contract_assert should eliminate the need to use assert at all and is an over all substantial UX improvement.