[Swift-devel] iterate behaviour round II

Ben Clifford benc at hawaga.org.uk
Wed Aug 3 12:50:59 CDT 2011


> The dependent iterations are also covered by foreach, and you can't
> deadlock as easily as you can in the iterate case:

I think I disliked that approach before because my thinking was that Swift 
should require a to be full defined outside of the foreach. But there's no 
really strong reason for requiring that (after all, it was the whole point 
of iterate...) and I think it looks nice with the << syntax.

> Though now you could equally do:
> int a[auto]; a << 10;
> foreach v in a {
>   if (v > 1) { a << v - 1; }
> }

-- 



More information about the Swift-devel mailing list