mpusz / wg21-papers

ISO C++ Committee papers by Mateusz Pusz
https://mpusz.github.io/wg21-papers
4 stars 7 forks source link

P2981: Johel to fill "6.9 non-negative quantities" #33

Closed JohelEGP closed 11 months ago

JohelEGP commented 11 months ago

Starting point: https://github.com/mpusz/mp-units/issues/468#issuecomment-1705317626.

JohelEGP commented 11 months ago

§6 Safety Features says

This chapter will describe the features that enforce safety in our code bases.

It seems that "non-negative quantities" is the only sub-chapter of §6 that isn't a safety feature. Should I move it to 7 Safety Pitfalls?

mpusz commented 11 months ago

Why do you think it is not a safety feature? The chapter introduction does not claim to provide compile-time safety, and in my opinion, contract checks are about safety as well.

JohelEGP commented 11 months ago

I just haven't convinced myself that having to explicitly opt into the property of "non-negative" is a safety feature. It is a safety feature being able to do it, and it is a usability feature being able to not require it. But as I mention at https://github.com/mpusz/mp-units/issues/468#issuecomment-1758148563 and https://github.com/mpusz/mp-units/issues/468#issuecomment-1758340180, there are also safety pitfalls lurking, so I think we still need another chapter for non-negative quantities in 7 Safety Pitfalls.

mpusz commented 11 months ago

If you would like to provide another chapter in Pitfalls, please add it.

In case anyone sees something missing, please feel free to add more content to papers.