Hello everyone,
I would like to give some feedback on the proposal.
I think the proposal is quite reasonable and in essence very similar to Walter E. Brown's proposal N4435
N4415 suggests to have switches for turning on-off validation, in case the runtime does validate something.
This leaves things as an all-or-nothing feature, meaning that if you don't check preconditions,
you will not check any. For me, it makes sense that we don't check is_sorted + is_permutation after sorting,
but it is valuable to check for container !empty() and similar conditions.
I think there should be a way to leave cheap preconditions in code
always enabled.
The use case for this is that bugs occur. There are pre and
postconditions that are worth to be left enabled even in production
environments, saving valuable debugging time should a problem occur.
Therefore, I would suggest to augment expects and ensures with
expects_always and ensures_always (or similar) for checks
that will always be performed, not affected by the contract
switches.
Best Regards