[Swift-devel] New syntax for appending to arrays
Yadu Nand
yadudoc1729 at gmail.com
Tue Jun 28 09:24:49 CDT 2011
> This sound good. I assume one should be able to append to any dimension of a multi-dimensional array with +=.
>
> int a[][];
>
> a[5] += 1
> a[5] += 2
>
> sets a[5][?] = 1
> a[5][?] = 2
>
> where ? is the index values chosen by +=
Yes, where ? is the thread prefix id. (usually this is just 0,1,2.. )
> Further, as you work out the typing rules for array subscripts, should the following work?
>
> int a[][[];
> int b[];
> b += 100;
> b += 200;
> a += b; # <=== should this append a new array to a?
Right now, a+= b works. += or APPEND is an improvisation over
the usual ASSIGN. So everything that is meaningful to the compiler
in ASSIGN works here as well.
The question of whether this is supposed to work, I don't really know.
--
Thanks and Regards,
Yadu Nand B
More information about the Swift-devel
mailing list