You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 :)
The text was updated successfully, but these errors were encountered:
Alexsey
changed the title
Another way to solve issues
Precedence suboperator
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
There are a number of issues that are now actively discussed:
await
- Current suggestedasync
syntax feels *very* confusing #83And 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 andb
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 :)
The text was updated successfully, but these errors were encountered: