[Swift-devel] New syntax for appending to arrays

Mihael Hategan hategan at mcs.anl.gov
Tue Jun 28 12:30:33 CDT 2011


On Tue, 2011-06-28 at 12:21 -0500, Jonathan Monette wrote:
> I guess my question would be what would a look like?  What if this was called.
> 
> int a[];
> int b[];
> a=[1,2,3];
> b=[4,5,6];
> 
> a+=b;
> 
> Saying append makes me think that a+=b would result in something like:
> 
> [1,2,3[4,5,6]]

But a is an array of ints. b is not an int.

> 
> Is this the case?  Or would it be [1,2.3,4,5,6].  In python this is called extend while the first is called append.

No. 

> 
> So are we talking about an extend operation or append operation?

So far we're only talking about:
t a[]; a += t;





More information about the Swift-devel mailing list