[Swift-devel] Possible bug with iteration in stable branch

David Kelly dk0966 at cs.ship.edu
Fri May 28 12:28:02 CDT 2010


Hello,

I believe there may be a bug with iteration in the stable branch of Swift.
Below is the code I am using (which came from the swift tutorial):

iterate.swift
-----------------
type counterfile;

(counterfile t) echo(string m) {
  app {
    echo m stdout=@filename(t);
  }
}

(counterfile t) countstep(counterfile i) {
  app {
    wcl @filename(i) @filename(t);
  }
}

counterfile a[]  <simple_mapper;prefix="foldout">;

a[0] = echo("793578934574893");

iterate v {
  a[v+1] = countstep(a[v]);
 trace("extract int value ", at extractint(a[v+1]));
} until (@extractint(a[v+1]) <= 1);
----------------

wcl
---------
#!/bin/bash
echo -n $(wc -c < $1) > $2
---------

Using the development version of swift the script works correctly, with the
following output:

Swift svn swift-r3335 cog-r2752

RunID: 20100528-1243-6on02joa
Progress:
SwiftScript trace: extract int value , 16.0
SwiftScript trace: extract int value , 2.0
SwiftScript trace: extract int value , 1.0
Final status:  Finished successfully:4

However, when I use the stable branch (either using the tar.gz or by
downloading from svn) I get:

Could not start execution.
    variable a has multiple writers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-devel/attachments/20100528/75f3a6ed/attachment.html>


More information about the Swift-devel mailing list