api-guidelines icon indicating copy to clipboard operation
api-guidelines copied to clipboard

Elaborate the C-DEREF guideline

Open NeverGivinUp opened this issue 3 years ago • 1 comments

The motivation for the C-DEREF guideline and the potential problems resulting from ignoring it are (imho) not self explaning. The strongest clue I can find is from the guideline being filed in the Predictability section.

Neither the guideline, the doc or the smart pointer section of The Book explicitly define the difference between smart pointers and general applications of the newtype pattern. Outside the std library contributors there does seem to be confusion (see this old reddit thread). Maybe just referencing C-SMART-PTR would suffice.

Ideally the guideline shouldn't just describe what not to do, but what to do instead: When to impl AsRef/AsMut? What other options are there?

NeverGivinUp avatar Dec 27 '21 12:12 NeverGivinUp

I just saw #251, which might make this issue obsolete. If you feel it does, just close it.

NeverGivinUp avatar Dec 27 '21 18:12 NeverGivinUp