RFC: naming for FrontTransversal and Transversal ranges

Rainer Deyke rainerd at eldwood.com
Sat May 2 16:11:11 PDT 2009


Robert Jacques wrote:
> Again, D array's are structs with reference semantics. This isn't a
> pro/con either way.

The D1 dynamic array type does not have reference semantics, nor does it
have value semantics.

void f(int[] a) {
  a.length = 1;
}

auto a = [];
f(a);
assert(a.length == 0);

>>   - No long distance dependencies.
> 
> Well, if I can't copy it, then I have to use ref everywhere, which is
> functionally equivalent to reference semantics. I think you've just
> proved the counter-point.

Given a value type 'T', you have the guarantee that no two variables of
type 'T' can alias each other.  This guarantee is preserved when the
type 'T' is non-copyable.

An argument of type 'ref T' can obviously alias a variable of type 'T'.

>>   - RAII.
> 
> Can be done with structs or classes. Also see point 1. So, this isn't a
> pro/con either way.

The D1 dynamic array type does not support RAII.


-- 
Rainer Deyke - rainerd at eldwood.com



More information about the Digitalmars-d mailing list