4 ms·
Is there a Go example somewhere?
by Rochus 3y ago
Is there a Go example somewhere?
- 082349872349872 3y agoNot Go, but there is example X7 on p117 of http://www.usingcsp.com/cspbook.pdf http://www.usingcsp.com/cspbook.pdf VAR_x = (left?y -> VAR_y | right!x -> VAR_x) as Hoare notes on p116: (not wrt mixed select, but the ultimate logic is the same) > To wait for the first of many possible events is the only way of achieving this: purchase of faster computers is useless. (note that Hoare78 discusses the desirability of output guards in §7.8 but there it isn't clear that they ought to occur mixed with input guards)
- Rochus 3y agoThanks. But I'm I wrong to assume that this could be worked around by two additional processes and channels?
- 082349872349872 3y agoBy what means would the two additional processes share the variable state? (I come from the pure message passing tradition and don't know much about Go so this may be a moot objection) FWIW Hoare thinks it makes for a simpler system if it is always possible to rewrite any SEQ as a PAR and vice versa.
- Rochus 3y agoMeanwhile I got a sample to which there is no adequate solution with my current proposal as long as we should not close the channel: https://news.ycombinator.com/item?id=38768025 https://news.ycombinator.com/item?id=38768025. Here are two proposals for a SELECT procedure if you want to take a look at it: https://news.ycombinator.com/item?id=38767926 https://news.ycombinator.com/item?id=38767926