On 31.10.2010 6:56, Andrei Alexandrescu wrote:
[snip]
Walter and I discussed the matter again today and we're on the brink of deciding that cheap copy construction is to be assumed. This simplifies the language and the library a great deal, and makes it perfectly good for 95% of the cases. For a minority of types, code would need to go through extra hoops (e.g. COW, refcounting) to be compliant.

I'm looking for more feedback from the larger D community. This is a very important decision that marks one of the largest departures from the C++ style. Taking the wrong turn here could alienate many programmers coming from C++.

So, everybody - this is really the time to speak up or forever be silent.


Andrei

The only things I've ever seen in C++ _correctly_ using _costly_ copy constructor are containers and some bignums, but then most of the time one need to define swap for it to perform well in the std::sort for instance, and that is oftentimes forgotten. That indicates that containers are better off being reference types, which is what they are in D anyway, and bignums I do belive could use COW/small number optimization.

I'd go with cheap constructors assumed given that it simplifies matters a lot.

--
Dmitry Olshansky

Reply via email to