http://d.puremagic.com/issues/show_bug.cgi?id=3971



--- Comment #21 from Don <clugd...@yahoo.com.au> 2011-11-19 13:52:04 PST ---
(In reply to comment #20)
> Also from that thread:
> 
> First thing:
> 
> int[3] a=3; // kill it!!
> 
> Rest:
> 
> a[] is _just a shortcut_ for a[0..$]! Are you really suggesting to disallow
> slicing?

Currently it is just a shortcut, but that's a horrible waste of a symbol. [] is
a potentially very useful piece of syntax, which is currently almost unused.
It is currently used to resolve ambiguity in array operations. In all other
cases, it's redundant.
Bearophile has seen how successful it is in array operations, and would like to
see it used in the same way in simple element-wise assignment.

That is, element wise assignment should never occur without a slice syntax.

(The converse isn't true, block assignment sometimes occurs even when slices
are present, see below).

The analysis avoids the confusing case: where the element type is an array.

int [][3] x;
int [] y;
int [] z;

x[] = z;
y[] = z;
These look the same, but do very different things. The first one just copies
the z pointer. The second one copies the elements in z.
y[] = z[]; makes things clearer.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to