[Swift-user] what is wrong with restart5.swift?

Ben Clifford benc at hawaga.org.uk
Sun May 25 05:32:29 CDT 2008


Look at the below code and tell me if you think it should work or not 
(i.e. if its buggy or not). It fails for me with a 'multiple mappings 
point to the same file' error.

helperA, B, and C all write the word 'foo' into the filename passed as 
argument (so most of the intermediate data ends up getting ignored 
deliberately).

(I came up with this whilst working on testing for concurrent mapper and 
restarts, but it fails irrespective of restarts when I think it should 
work; however the reason for failure does not leap out at me)

type file;

(file t) a(file i) {
    app {
        helperA @filename(t);
    }
}

(file t) b(file i) {
    app {
        helperB @filename(t);
    }
}

(file t) c(file i) {
    app {
        helperC @filename(t);
    }
}

(file r) q(file i, int n) {
file t;
switch(n) {
case 1: t=a(i); r=c(t);
case 2: t=b(i); r=c(t);
case 3: t=c(i); r=c(t);
}
}

file J <"restart.in">;

file X[];

file Y[];

foreach i in [1:3] {
  X[i] = q(J,i);
}

foreach x,j in X {
Y[j] = q(x,j);
}





More information about the Swift-user mailing list