On Wednesday, 4 March 2015 at 10:50:54 UTC, Walter Bright wrote:
On 3/4/2015 1:16 AM, bearophile wrote:
Walter Bright:
The complexity of a free list doesn't remotely compare to
that of adding an
ownership system.
A sound complete ownership system is the only good enough
solution for D. That's
my opinion.
How do you type an an array of pointers with different owners?
You define a clear owner for everything so that this never
happens.
That's what we do in C++ and shared_ptr is can be avoided as much
as we like.
How do you deal with the combinatoric explosion of template
instantiations with all those different ownership types?
What we do in C++: with unsafety. Taking raw pointer in function
parameters and function returns.
Mark in comments assumptions about which lifetime exceed what.
Modern C++ has no such combinatoric explosion. Instead of a
std::vector of pointers, you know have a std::vector of
std::uinque_ptr.
It still is quite easy, in the very least easier that doing
deterministic destructon in D.