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

Change promises-guide references to Web IDL #1021

Merged
merged 4 commits into from Nov 3, 2019

Conversation

MattiasBuelens
Copy link
Collaborator

@MattiasBuelens MattiasBuelens commented Nov 2, 2019

The spec text has broken links to the old promises guide. This is inconvenient for readers, but it also causes builds for spec PRs to fail (see my comment on #1011).

This PR fixes the links by pointing to their new Web IDL counterparts.

Todo list (non-exhaustive, feel free to suggest other changes):

  • Get spec to build again.
  • Figure out what to do with "promise-calling".
  • Change usages of "react to promise" to explicitly pass one or two sets of steps (as in this example), instead of passing a "fulfillment handler" and a "rejection handler".
  • Change pairs of "upon fulfillment / upon rejection" to a single "react to promise". (Not that important right now.)

Fixes #1020


Preview | Diff

@ricea
Copy link
Collaborator

ricea commented Nov 2, 2019

Looks good so far.

@domenic
Copy link
Member

domenic commented Nov 2, 2019

Figure out what to do with "promise-calling".

I commented inline on some possible wording here.

Change usages of "react to promise" to explicitly pass one or two sets of steps (as in this example), instead of passing a "fulfillment handler" and a "rejection handler".

No need to stress this too much; I think just changing "fulfillment handler" to "fulfillment steps" is basically good enough. In particular for the "inline" usages (like "Return the result of transforming sourceCancelPromise with a fulfillment handler that returns undefined") I don't think we need to make that into a more complicated thing with sub-bullets and sub-algorithms.

Change pairs of "upon fulfillment / upon rejection" to a single "react to promise".

This is good but could be done as an editorial followup, as "upon fulfillment" and "upon rejection" still exist and the semantics of using them separately is the same as using "reacting" together. So if it's going to delay merging don't worry about that.

Copy link
Collaborator Author

@MattiasBuelens MattiasBuelens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All right, I've kept the changes to a minimum, just enough to unblock other spec changes. We can always do a more thorough refactor later on.

In principle, we should also keep the reference implementation in sync with the spec text changes. That means we should rename (and update?) the helpers in the reference implementation to align with Web IDL. But this can probably wait until another time as well.

@@ -884,7 +884,7 @@ for="ReadableStreamAsyncIteratorPrototype">return( <var>value</var> )</h4>
1. If *this*.[[preventCancel]] is *false*, then:
1. Let _result_ be ! ReadableStreamReaderGenericCancel(_reader_, _value_).
1. Perform ! ReadableStreamReaderGenericRelease(_reader_).
1. Return the result of <a>reacting</a> to _result_ with a fulfillment handler that returns !
1. Return the result of <a>reacting</a> to _result_ with a fulfillment step that returns !
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opted for a singular "fulfillment step" here, because I thought it sounded a bit weird with plural "steps":

Return the result of reacting to result with fulfillment steps that return ReadableStreamCreateReadResult(value, true, true)

In particular, I didn't like how the verb "return" must be plural in that sentence, while there's only a single step.

1. Return the result of <a>transforming</a> _flushPromise_ with:
1. A fulfillment handler that performs the following steps:
1. Return the result of <a>reacting</a> to _flushPromise_:
1. If _flushPromise_ was fulfilled, then:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was already very close to the new format from the example, so I went ahead and refactored it. I must say: I like this new format quite a bit! 😄

index.bs Outdated Show resolved Hide resolved
@MattiasBuelens MattiasBuelens marked this pull request as ready for review November 3, 2019 16:15
@domenic domenic merged commit d26db0e into whatwg:master Nov 3, 2019
@MattiasBuelens MattiasBuelens deleted the webidl-promises branch November 3, 2019 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Links to "a new promise", "a promise resolved with", etc. are broken
3 participants