On Mon, 19 Jan 2009 12:21:59 +0300, Qian Xu <[email protected]> wrote:
Denis Koroskin wrote:
...
For example, let's modify CSTR and see what happens:
CSTR[0] = 'J'; // now it is "Jello"
printing e.str and e2.str gives us the following output:
Jello
Jello
...
Hi again,
but there is one thing, I do not understand.
CSTR is a constant. But with "CSTR[0] = 'J'", you can modify a const
anyway,
cannot you?
D1 has no const support.
BTW: Do you know, why D do not use copy-on-write semantic instead of
referencing? IMO, copy-on-write is much performanter.
--Qian
It's not about performance (explicit memory management is faster, too), but
semantics.
Arrays in D are reference types. Besides, it's best to avoid hidden allocations.