On 2010-10-30 23:56:24 -0400, Andrei Alexandrescu <seewebsiteforem...@erdani.org> said:

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.

A simple question: can a reference counter work with const and immutable?

        const(S) func(ref const(S) s) {
return s; // this should increment the reference counter, but can we bypass const?
        }

Bypassing const/immutable could work, but if your data is immutable and resides in read-only memory you'll get a crash.

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

Reply via email to