Currently,
when(r) -> done(foo) {
good
} catch problem {
bad
}
expands to
r <- whenResolved(define done {
to run(temp1) : void {
if (E isBroken(temp1)) {
define problem := E optProblem(temp1)
bad
} else {
define foo := temp1
good
}
}
})
which captures well what has become the standard idiom for using
whenResolved. However, in looking through the site (using the new
navigation controls), http://www.erights.org/elang/concurrency/race.html
reminded me on a subtle principle-of-least-authority issue I got right early
on, but then forgot. As a result, it didn't make it into the standard
idiom, and was thereby not captured by the when/latch/catch construct.
The issue is shown by the use of "once" in "asynchAnd" to guard
Syntactic sugar should capture safe idioms. After all, if
define temp2 := true
r <- whenResolved(define done {
to run(temp1) : void {
if (temp2) {
temp2 := false
if (E isBroken(temp1)) {
define problem := E optProblem(temp1)
bad
} else {
define foo := temp1
good
}
}
}
this?
})