On Mon, 01 Apr 2013 09:08:47 +0200, Traveler <noonekn...@example.com>
wrote:
On Friday, 29 March 2013 at 08:58:06 UTC, kenji hara wrote:
http://wiki.dlang.org/DIP32
Kenji Hara
Why not square brackets?
int i;
string str;
[i, str] = [5, "line"];
Tuple as alias to Object[] or to Variant[].
Mostly because it already has a meaning in D, namely that of an array.
What you have above certainly does not compile, but consider the case of a
homogeneous tuple:
int i = 1, j = 2;
[i, j] = [3, 4];
This is equivalent to this code:
[1, 2] = [3, 4];
Which of course is nonsense, but it already has a meaning. Using an
existing syntax leads to many many more corner cases and gray areas than
creating a new syntax does. Of course, {} also has a meaning already, but
the overlap of semantics is much smaller, and thus the potential corner
cases and gray areas are fewer and smaller.
--
Simen