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

Leandro Lucarella llucax at gmail.com
Mon Jul 27 06:50:01 PDT 2009


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.

-- 
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
----------------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------------
Seducimos a una minita con el objetivo de llevarla a nuestro hogar; más
que seducirla la amenazamos con una botella.
	-- Sidharta Kiwi



More information about the Digitalmars-d mailing list