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

Remove await from current minimal proposal spec #108

Merged
merged 1 commit into from
Mar 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 1 addition & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,30 +94,7 @@ As you can see, because the pipe operator always pipes a single result value, it

### Use of `await`

The pipeline operator allows the result of a `Promise`-returning function to be `await`ed as follows:


```js
x |> await f
```

which is the equivalent of

```js
await f(x)
```

This is to allow you to `await` the result of an asynchronous function and pass it to the next function from within a function pipeline, as follows:

```js
const userAge = userId |> await fetchUserById |> getAgeFromUser
```

which is the equivalent of

```js
const userAge = getAgeFromUser(await fetchUserById(userId))
```
The current minimal proposal makes `|> await f` an early error, so there is no support currently for `await` in the pipeline. Each proposal has a different solution to `await` in a pipeline, so support is planned. Please see the respective proposals for their solutions.

### Usage with `?` partial application syntax

Expand Down
6 changes: 0 additions & 6 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ <h1>Syntax</h1>
LogicalORExpression[?In, ?Yield, ?Await]
[~Await] PipelineExpression[?In, ?Yield, ?Await] `|>` LogicalORExpression[?In, ?Yield, ?Await]
[+Await] PipelineExpression[?In, ?Yield, ?Await] `|>` [lookahead &lt;! {`await`}] LogicalORExpression[?In, ?Yield, ?Await]
[+Await] PipelineExpression[?In, ?Yield, ?Await] `|>` `await` LogicalORExpression[?In, ?Yield, ?Await]
</ins>
</emu-grammar>
</emu-clause>
Expand Down Expand Up @@ -81,11 +80,6 @@ <h1>Runtime Semantics: Evaluation</h1>
1. Let _result_ be the result of PipelineEvaluate for |PipelineExpression| and |LogicalORExpression|.
1. Return _result_.
</emu-alg>
<emu-grammar>PipelineExpression : PipelineExpression `|>` `await` LogicalORExpression</emu-grammar>
<emu-alg>
1. Let _result_ be the result of PipelineEvaluate for |PipelineExpression| and |LogicalORExpression|.
1. Return ? AsyncFunctionAwait(_result_).
</emu-alg>
<emu-grammar>PipelineExpression : LogicalORExpression</emu-grammar>
<emu-alg>
1. Return the result of evaluating |LogicalORExpression|.
Expand Down