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

Precedence suboperator #88

Closed
Alexsey opened this issue Jan 25, 2018 · 2 comments
Closed

Precedence suboperator #88

Alexsey opened this issue Jan 25, 2018 · 2 comments

Comments

@Alexsey
Copy link

Alexsey commented Jan 25, 2018

There are a number of issues that are now actively discussed:

And some discussions has reached the point where another supportive operators are proposing to solve some of non-trivial problems like |>> and |await>. I think there is a general way to solve (almost) all this problems with one additional general operator. It should act like round brackets in common code and provide a way to write an expression that would calculated on pipeline declaration stage while the result would be used on the pipeline calculation stage. I don't want to propose some specific syntax - it's not about what symbols should be used so for illustrating purposes I'll use <>. Also I'll use one of currently discussed forms of |> - I'm not standing on exactly on this form - it's just looking nice when writing up an examples:

f(a) -> f |> a
f(g)(a) -> a |> <f(g)>
f(a, b) -> a |> f(?, b)
await f(a) -> f |> await a
(await f)(a) -> a |> <await f>
(await obj.f())(a) -> a |> <await obj.f()>
(await obj.f()).g(a) -> a |> <await obj.f()>.g
await (await obj.f()).g(a) -> a |> await <await obj.f()>.g

I would like also to notes that this brings even more freedom to when we want to calculate arguments - on declaration stage or on execution stage - both are available (there was some old issue about that in the sense of curring):

consider that I want to pass a value from declaration stage and b value from calculation stage:
|> f(<a>, b)

If this idea would really be good enough to solve all the above problems - only than I think we should start the bikeshedding about specific syntax :)

@Alexsey Alexsey changed the title Another way to solve issues Precedence suboperator Jan 25, 2018
@pitaj
Copy link

pitaj commented Jan 25, 2018

How is this any different from just parenthesis? The only difference here is two await examples, which to me seem better solved with |> await |>. Every other example treats <> exactly the same as parenthesis.

f(a) -> f |> a
f(g)(a) -> a |> f(g) - parenthesis unnecessary
f(a, b) -> a |> f(?, b)
await f(a) -> a |> f |> await - your example has backwards data flow. Did you mean a |> await f?
(await f)(a) -> a |> (await f) - just use parenthesis
(await obj.f())(a) -> a |> (await obj.f()) - just use parenthesis
(await obj.f()).g(a) -> a |> (await obj.f()).g - just use parenthesis
await (await obj.f()).g(a) -> a |> (await obj.f()).g |> await - just use parenthesis with @gilbert syntax

@Alexsey
Copy link
Author

Alexsey commented Jan 25, 2018

Yes, the reason why I decide that parentheses are not enough is because of await case. But |> await solves the issue

@Alexsey Alexsey closed this as completed Jan 25, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants