On Friday, 17 May 2019 at 20:04:42 UTC, Walter Bright wrote:
Dip1000 is key to enable containers to control access to pointers to their innards that they expose.

I haven't looked at the subject for a while, but every time I did the takeaway was the same: dip1000 works great for containers until you need to reallocate or free something, at which point it's back to @trusted code with you.

I think you said at some point "It's still useful, because it reduces the surface of code that needs to be checked", but even then saying containers can "control access to the data they expose" is a little optimistic.

They only control that access as long as you don't need to call resize(). I'd wager that a large fraction of dangling pointer errors made by non-beginner C++ developpers come specifically from this use case.

Reply via email to