On 2009-04-29 23:01:39 -0400, Rainer Deyke <rain...@eldwood.com> said:

Andrei Alexandrescu wrote:
2. Value semantics with reference counting

I like this optimization and use it all the time in my own code, but I'm
not convinced that it should be the default.  It's also problematic in
multithreaded situations.

I think a generic CopyOnWrite wrapper over arbitrary value types would
be more useful.  CopyOnWrite!(int[]).

But don't forget that D2 is going to have the shared keyword, possibly with thread-local heaps. So multithreading won't be much of a problem: if the variable is shared, the compiler should force locks as needed or use atomic operations; if the variable is local to a thread, locks should become no-ops and atomic operations regular ones, improving performance.

Or at least that's what I'm getting from the hints we currently have.


3. Reference semantics

I'm strongly opposed to this option.  Either of the other options would
be acceptable.

Andrei mentioned a couple of reasons against 3, which are yours?


--
Michel Fortin
michel.for...@michelf.com
http://michelf.com/

Reply via email to