[Swift-devel] Changes to array closing semantics?

Mihael Hategan hategan at mcs.anl.gov
Wed Nov 21 23:32:58 CST 2012


On Wed, 2012-11-21 at 18:36 -0800, Mihael Hategan wrote:
[...]
> > 
> > foreach i in [0:10] {
> >   a[i] = 1;
> >   f(a);
> > }
> 
> It shouldn't deadlock. Nothing should. It just does in the current
> swift/k implementation.
> 
> > 
> > In Swift/T it does the same thing as:
> > foreach i in [0:10] {
> >   a[i] = 1;
> > }
> > foreach i in [0:10] {
> >   f(a);
> > }
> 
> I don't know if I'd expect that if I wrote that code. Another
> possibility is that I want f to be invoked successively with [1], [1,
> 1], [1, 1, 1], etc. So I don't think it's obvious what that code should
> do, and I'd be inclined to have it forbidden. If the required behaviour
> is f([10x1]) ten times, then the user can state that explicitly by
> writing the equivalent code you mention.

I would like to revise my statement. I agree with your proposed solution
from a dataflow perspective (which I lost there for a bit). When
invoking f(a) you are saying run f with some array as argument and the
issue of where that array is built is not relevant.

Mihael




More information about the Swift-devel mailing list