-
Notifications
You must be signed in to change notification settings - Fork 25
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
Pipeline + Partial Application + await/yield #16
Comments
I think with the current proposal semantics, it would be translated this way: double(await ?)
//=>
double(x => await x) ...because the |
If partial application results in eager evaluation, I would need to add a special form for const foo = await (1
|> (async x => addOne(await x))
|> (async y => double(await y))
); Another approach might be to have some syntax for an async pipeline, similar to const foo = 1
await |> addOne(?)
await |> double(?); |
You can easily achieve the same thing without a special syntax: const foo = await p
.then(addOne(?))
.then(double(?)) |
Wouldn't |
Yes, but the point is that with promises, it's moderately a moot point because we already have |
Given that the pipeline proposal has moved forward with Hack-style, and the new syntax and semantics from #49, this is no longer an issue for partial application. Since partial application is eager,
The same would apply to I've added these along with desugaring examples to EXAMPLE.md in the repository root. |
Context: tc39/proposal-pipeline-operator#53
Does it make sense to introduce a way to integrate the syntax of this proposal and the pipeline proposal in the case of async functions?
If it was legal to place
await
within a partially applied function when part of a pipeline, then:would be loosely equivalent to:
which in turn is loosely:
Syntax alternative:
The text was updated successfully, but these errors were encountered: