Developing a plan for D2.0: Getting everything on the table

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Jul 27 10:58:49 PDT 2009


Bill Baxter wrote:
> The requirement to add the post-blit is a little annoying.  If a
> ValueContainer is made fundamental and it is built initially out of
> components with value semantics, then no explicit post-blit will be
> necessary.  However if you go the other way and start with a
> RefContainer then a post-blit will be necessary when you implement the
> ValueContainer based on it.   So to me it seems a little better to go
> with the ValueContainer as the base implementation.

I think it's a matter of the most frequent use. I used to be a staunch 
supporter of values for containers, until Walter revealed to me that in 
STL you have value containers to constantly worry about adding the "&" 
everywhere. Implicitly copying containers is 95% of cases an error in 
C++ code. Witness all that advice about pass by reference etc. So why 
make that the default, one might ask? Better go with the flow and make 
the default case the easy case (reference), and if someone does want a 
value, have them write Value!Container.


Andrei



More information about the Digitalmars-d mailing list