Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Design: "Replace" flows #10

Open
ReedOei opened this issue Jan 13, 2021 · 0 comments
Open

Design: "Replace" flows #10

ReedOei opened this issue Jan 13, 2021 · 0 comments

Comments

@ReedOei
Copy link
Owner

ReedOei commented Jan 13, 2021

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:

B --> C
A --> B

Here are some possible syntax choices for this operation:

  1. "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.
A -->2 B -->1 C
  1. "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
  1. 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.
A --> (B --> C)

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant