aula icon indicating copy to clipboard operation
aula copied to clipboard

Remove `assert`-s from the code.

Open andorp opened this issue 8 years ago • 6 comments

andorp avatar Mar 20 '16 19:03 andorp

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.

fisx avatar Mar 20 '16 20:03 fisx

I would take a step further, and turn them into some type safety trick.

andorp avatar Mar 20 '16 21:03 andorp

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.

Mikolaj avatar Mar 21 '16 09:03 Mikolaj

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.

andorp avatar Mar 21 '16 09:03 andorp

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.

Mikolaj avatar Mar 21 '16 09:03 Mikolaj

When we have enough data points at the late stage of the project.

andorp avatar Mar 21 '16 09:03 andorp