It is often useful to have a "replace" operation, where we replace B with A, and flow the old value of B to C. That is, the following situation:
Here are some possible syntax choices for this operation:
- "Flow ordering" version. Pros: Easy-to-implement syntactic sugar; extensible to more than 2 flows ("multi-replace"). Cons: Looks strange, not clear what it does.
- "Natural language" version. Pros: Can be read out loud; Cons: doesn't look like anything else in the language
replace B with A and flow to C
- Use parentheses to suggest order. Looks more normal, has all the other benefits of the "flow ordering", but is a little "subtle", and may be unclear there is a difference between this and the unparenthesized version.
Alternatively, maybe writing two lines of code isn't that bad a thing... Or, for the specific case of consume, we can have an overwrite
It is often useful to have a "replace" operation, where we replace
BwithA, and flow the old value ofBtoC. That is, the following situation:Here are some possible syntax choices for this operation:
Alternatively, maybe writing two lines of code isn't that bad a thing... Or, for the specific case of consume, we can have an
overwrite