[Swift-devel] New syntax for appending to arrays

Yadu Nand yadudoc1729 at gmail.com
Tue Jun 28 14:01:57 CDT 2011


On Wed, Jun 29, 2011 at 12:26 AM, Mihael Hategan <hategan at mcs.anl.gov> wrote:
> I very much agree with this, except I wouldn't say that one could
> approach this from a type system perspective, but it is necessary to do
> so. Using auto-indices on an int array would break things if the
> auto-indices are string (which they are). In other words, the following
> code would pass type checking but is essentially incorrect:
> int a[];
> a += 1; a += 2;
>
> foreach v, k in a {
>  trace(k + 1);
> }
This doesn't fail.
a += 1 ; a += 2 ;
Eventually comes to a[x] = 1 ; a[y] = 2  (where x and y are thread prefixes
which turn out to be integers).

-- 
Thanks and Regards,
Yadu Nand B



More information about the Swift-devel mailing list