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

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Jul 27 07:48:51 PDT 2009


Leandro Lucarella wrote:
> Andrei Alexandrescu, el 27 de julio a las 07:59 me escribiste:
>>> For example, should the author of a container library prefer classes or 
>>> structs?
>> I've been struggling with this forever. I don't know. I don't even know
>> whether reference or value semantics are best for containers. I don't
>> know whether abstract container interfaces and container-independent
>> code are a net win; experience with STL seems to say "don't" and
>> experience with Java seems to say "ho-hum".
> 
> About values vs. reference semantics, I think reference is the best.
> Containers usually are big, and you don't want to copy them arround.
> I find myself using lots of references to pass containers arround in C++
> and almost never use the copy() method of Python containers, so based on
> *my* experience, I'd say that reference as the default is the best
> approach.

Sounds convincing.

Andrei



More information about the Digitalmars-d mailing list