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

Add shorthand "prose hooks" for performing various operations #21

Closed
domenic opened this issue Sep 5, 2013 · 3 comments
Closed

Add shorthand "prose hooks" for performing various operations #21

domenic opened this issue Sep 5, 2013 · 3 comments

Comments

@domenic
Copy link
Owner

domenic commented Sep 5, 2013

People seem confused, and want to know how they can do Promise.reject or Promise.all in their specs. It's pretty straightforward; you say:

Let x be the result of Promise.reject(r), using the initial value of Promise.reject.

But we may want to provide some easy phrases that are shorthand for this longhand. Here's what I can think of:

  • a promise resolved with x (e.g. "return a promise resolved with x," "let p be a promise resolved with x")
  • a promise rejected with r
  • cast x to a promise
  • let p be a newly-created promise object (the ES spec already uses this as shorthand for some crazy @@create stuff)
  • resolve p with x
  • reject p with r
  • let p be the result of (racing p1, p2, p3 / racing iterableOfPromises)
  • let p be the result of waiting for all of (p1, p2, p3 / iterableOfPromises) (any better phrasing?)
@annevk
Copy link
Collaborator

annevk commented Sep 5, 2013

  • Let p be the first of p1, p2, p3
  • Let p be all of p1, p2, p3

@tabatkins
Copy link

"be the first of" is extremely ambiguous in English - it sounds like it's just referring to p1 in a stupid way. I prefer Domenic's wording.

Same with "let p be all of ..." - sounds like it's just collecting them into a list or something. "waiting for all" it a little long, but it's clear and easy to remember, so I'm fine with it.

@domenic domenic closed this as completed in 67c2ba9 Sep 7, 2013
@domenic
Copy link
Owner Author

domenic commented Sep 7, 2013

Added a guide with these plus some guidance and examples. Could probably use more examples; pull requests welcome in that department.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants