Better distinguishing reference and value in the syntax?

Gou Lingfeng goughost at yahoo.com.cn
Sun Jan 1 21:25:41 PST 2012


D's definitions of "is" and "==" have so much redundency. That might
indicate some flaw. If references and values (for classes and arrays)
could be clearly distinguished in the syntax, the "is" operator is not
necessary at all.

A related thing is element-wise operation. Consider
string[] a;
string[] b;
string[] c;
...
c[1..3]=a[1..3]~b[1..3];

and,

int[] a;
int[] b;
int[] c;
...
c[1..3]=a[1..3]+b[1..3];

The two pieces are very much similar, and I expect similar results. But
D doesn't provide element-wise concatenation, because it's not clear in
the syntax whether a[1..3] is a reference (for simple array
concatenation) or a value (for element-wise concatenation).



More information about the Digitalmars-d mailing list