Open DavePearce opened 3 years ago
Perhaps a minimal primitive would be an extended assignment statement:
x = e when c
Basically, the assignment either spinlocks until the condition is true (not very flexible) or just fails if the condition is not true.
An interesting question is whether or not we can already implement a compare and swap primitive with the existing syntax of Whiley. My angle of attack on this is to target the multiple assignment statement. Specifically, in a form like this:
The key here is that, if
i == j
, then the above assignsX
toA[i]
otherwiseA[i]
is untouched. This is somehow a compare and set. We could have some definitions like this:Don't quite know how to exploit this observation yet