Phobos is now compiled with -preview=dip1000
couteaubleu at gmail.com
Sat May 18 15:02:43 UTC 2019
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.
More information about the Digitalmars-d-announce