Walnut/Distributed Computing/Multiway when-catch
From Erights
(Difference between revisions)
Kevin Reid (Talk | contribs) m (Reverted edits by FwaH24 (Talk); changed back to last version by Mscheffler) |
(FIELD_OTHER) |
||
Line 18: | Line 18: | ||
In this when-catch, since all the arguments are vows, the corresponding parameters (engineTemp and maxTemp, to the right of the "->") are simply local objects (integers in this case). How do we know that these integers will be local, not remote, even though we retrieved them from Rcvrs? Because integers are passed by construction, as discussed next. | In this when-catch, since all the arguments are vows, the corresponding parameters (engineTemp and maxTemp, to the right of the "->") are simply local objects (integers in this case). How do we know that these integers will be local, not remote, even though we retrieved them from Rcvrs? Because integers are passed by construction, as discussed next. | ||
- | + | FIELD_MESSAGE_ercboccaorg | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + |
Revision as of 20:49, 17 December 2008
Multiway when-catch
If you need to resolve several references before making a computation, use a multiway when-catch, in which you specify several arguments in the structure:
# E syntax def maxTempVow := vehicleSpecsRcvr <- getMaxEngineTemperature(carType) def engineTempVow := carRcvr <- getEngineTemperature() when (engineTempVow,maxTempVow) -> { if (engineTempVow > maxTempVow) {println("Car overheating!")} } catch e {println(`Lost car or vehicleSpecs: $e`)}
In this when-catch, since all the arguments are vows, the corresponding parameters (engineTemp and maxTemp, to the right of the "->") are simply local objects (integers in this case). How do we know that these integers will be local, not remote, even though we retrieved them from Rcvrs? Because integers are passed by construction, as discussed next.
FIELD_MESSAGE_ercboccaorg