[Swift-devel] iterate behaviour round II

Michael Wilde wilde at mcs.anl.gov
Wed Aug 3 09:23:29 CDT 2011


I propose that we do everything possible to ensure that the semantics of iterate does not change from 0.92.1, to avoid breaking code. NCAR and the DOE ParVis project, in particular, has a very large Swift script that they are testing for production use, and we really dont want that to break.

e should not allow 0.93 to break current user code -- if at all possible.

I propose instead that we experiment with new iterate semantics using one or more new statements (fold, do, while, for).  Ben, Mihael, and others are interested in functional-style statements; I am in favor of C-like statements. I would favor having both in the language as long as we keep it simple (which I understand is complex ;)

To start a parallel thread here: how feasible is it (within the write-once variable model and scope-creation semantics that iterate uses) to provide the 3 C iteration statements with syntax and semantics as close to C as possible?

- Mike

----- Original Message -----
> From: "Mihael Hategan" <hategan at mcs.anl.gov>
> To: "Swift Devel" <swift-devel at ci.uchicago.edu>
> Sent: Wednesday, August 3, 2011 12:22:21 AM
> Subject: [Swift-devel] iterate behaviour round II
> So I think we decided that:
> 
> iterate v {
> trace(v);
> } until (v >= 10);
> 
> would do the test after v was incremented and would always execute at
> least once (so 0 to 9 would be printed).
> 
> But then the tutorial has the following (adapted a bit):
> 
> 
> int a[]; a[0] = 10;
> iterate v {
> a[v + 1] = a[v] - 1;
> } until(a[v+1] < 1);
> 
> It's all peachy in concept, except if v is incremented before the
> check,
> an access to a[v+1] will hang. a[v] is now the correct expression in
> the
> test, but then it's not quite intuitive.
> 
> Proposal 1: change documentation and tests to "until(a[v] < 1)" (this
> does not solve the problem in general since a[v+1] would still lead to
> a
> hang, not unlike bug 481
> Proposal 2: Proposal 1 + deprecate iterate and suggest foreach
> instead.
> 
> Opinions? Other ideas?
> 
> Mihael
> 
> _______________________________________________
> Swift-devel mailing list
> Swift-devel at ci.uchicago.edu
> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel

-- 
Michael Wilde
Computation Institute, University of Chicago
Mathematics and Computer Science Division
Argonne National Laboratory




More information about the Swift-devel mailing list