[Swift-devel] Re: Phone meeting?

Mihael Hategan hategan at mcs.anl.gov
Mon Jan 14 12:44:14 CST 2008


I say we start an email discussion about swift improvements for lqcd
(but not necessarily only for lqcd).
I'll start with a few points:

1. The app blocks are ugly. The C/Java world uses modifiers for such
things. Therefore I'm thinking that

(file output) cvt12x12 (file input) {
        app {
                CVT12x12 "-v" "-i" @input "-o" @output;
        }
}

should become

app (quark output) cvt12x12 (file input) {
        CVT12x12 "-v" "-i" @input "-o" @output;
}

2. Improved iteration. I already sent an email to swift-devel, but I'll
re-iterate here:

Given X[n] and Y[n],

(a) for (x, y) in (X, Y) {} will be roughly equivalent to
for dummy, i in X {
  x = X[i]; y = Y[i];
}

and

(b) for (x, y) in (X * Y) {} will be equivalent to:

for x in X {
  for y in Y {
  }
}

I think (a) offers a cleaner appearance than the current alternative,
while (b) is only a marginal improvement.

3. I'll need a list of data objects for which you care about the file
names, and the corresponding file names.

4. There are two basic ways to construct lists/arrays: the
comprehension/functional way and the imperative (for loop) way. Swift
has chosen the imperative style. This works fine specifying data
dependencies, but falls short for mapping/file names. Swift requires
that mappings be specified in one step, which means that file name lists
need to be constructed before the mapping is expressed. However, in many
cases the naming patterns follow the data patterns, which means that
control structures will be duplicated. Allow me to demonstrate (in a yet
to be version of the language):

string masses[] = ["0.005", "0.007", "0.01", "0.02", "0.03"];
string configs[] = ["000102","000108","000114"];

string fn[];

for (m, c), i in (masses * configs) {
  fn[i] = m + "_" + c;
}

file stags[][] <fixed_array_mapper; files=fn>;

But then another iteration over the configs needs to be done for the
actual calculations (and one for the masses, which is currently hidden
in an app).

The problem here is the inability of swift to allow specifying file
names for one piece of data in arbitrary places. The alternative would
be:

for configs, c in configs {
  for mass, m in masses {
    stags[c][m] &= m + "_" + c;
    stags[c][m] = stagSolve(gauge, mass, source);
  }
}

This may also eliminate the need for funny mapping tricks (in particular
the assignments with not-so-well-defined semantics).

5. Oh, and the + operator should be able to concatenate strings.




More information about the Swift-devel mailing list