[Swift-user] suggestion for program flow control
Michael Wilde
wilde at mcs.anl.gov
Sat Nov 15 20:50:10 CST 2008
Can this technique be readily applied to a function that runs N app()
functions in a foreach()?
(external o) doall(Collection c) {
foreach i in c {
x = someapp();
}
}
app sync(external o) {etc}
sync=doall()
summarize(sync);
Any way to make the completion of doall() dependent on the completion of
all the someapp() calls?
- Mike
On 7/8/08 1:59 AM, Ben Clifford wrote:
> On Tue, 17 Jun 2008, Ben Clifford wrote:
>
>>> I can definitely see the benefit of having separate pipelines for
>>> non-dependent parts within the same script, but perhaps there is a way
>>> to chain dependent functions that is not dependent on files produced by
>>> previous functions?
>> I've been playing with some code to do that as someone else requested it.
>>
>> Basically you will be able to have a swiftscript variable that expresses
>> the dependency, but doesn't have any actual content (such as a file).
>>
>> Hopefully later this week there will be something in SVN.
>
> Somewhat later than I'd hoped. Swift SVN r2095 has 'extern' types. You can
> use like this:
>
>
> (external o) a() {
> app {
> helperA @strcat(@arg("dir"),"/restart-extern.1.out") "/etc/group"
> "qux";
> }
> }
>
> b(external o) {
> app {
> helperB @strcat(@arg("dir"),"/restart-extern.2.out") "/etc/group"
> "baz";
> }
> }
>
>
> external sync;
>
> sync=a();
> b(sync);
>
> This makes a dependency between a and b, but doesn't actually move any
> data around; its entirely up to you to ensure that when the a procedure
> finishes your data is in the right place for b to find it.
>
More information about the Swift-user
mailing list