aula
aula copied to clipboard
Remove `assert`-s from the code.
why is this an enhancement? and what's wrong with assert
? they have a nice syntax for contract documentation, and they give good error messages. instead of banning assert
, i would prefer to write enough tests to make sure they will not be triggered in production.
I would take a step further, and turn them into some type safety trick.
I'm a strong proponent of assertions in place of some code comments (they almost never get out of date) and even as a supplementary testing tool. Tests by definition don't exhaustively try all the possible data combinations that may appear in production, while the assertions verify behaviour exactly on the production data and on all of it (the drawback is they do it too late and also they don't predict data that may appear in the future, while tests can and should). If we really want to disable assertions for a particular deployment, there are options to put in .cabal, or they may be specified per-file.
I am ok to have assertion in production for the time being, but for me it is a sign for a missing abstraction that we cover with an assert
. For the final product we should have an appropriate model.
Oh, yes, the assertions are very raw, unwieldy and unstructured. I'd be very interested to assist you in coming up with something better for our particular needs.
When we have enough data points at the late stage of the project.