[Swift-devel] Changes to array closing semantics?

Mihael Hategan hategan at mcs.anl.gov
Thu Nov 22 13:47:24 CST 2012


On Thu, 2012-11-22 at 17:49 +0000, Ben Clifford wrote:
> On Thu, 22 Nov 2012, Tim Armstrong wrote:
> 
> > I'm not sure if there a way to help users with potentially counter-intuitive behaviour, like a compiler
> > warning - aside from maybe documenting and explaining it better.
> 
> My opinion (still) is that getting rid of piecewise assignment is the 
> thing to do.
> 

I agree in principle, and I did so before in principle given that it
works that way in karajan: the main way of building lists is using
comprehensions.

But that makes it look very different from swift. The deep return values
is not something that I could see going into swift easily, because swift
isn't a "function-is-data" type of a language. I mean

header() {
  1, 2, 3
}

a = [
  header()
  for (i, range(10, 20)) {
    2 * i
  }
]

looks fundamentally different from everything swift, and something like
this would require serious changes to it I think. Maybe. Or maybe the
cost is lower in the long run.




More information about the Swift-devel mailing list