google / promises

Promises is a modern framework that provides a synchronization construct for Swift and Objective-C.
Apache License 2.0
3.8k stars 295 forks source link

Update index.md #144

Open jeff-h opened 4 years ago

jeff-h commented 4 years ago

Clarify an easy misconception regarding the usage of all.

ykjchen commented 4 years ago

Thanks for the addition @jeff-h. What do you think about this:

Note that `all` does not control when each contained promise task starts (a promise task starts when that promise is created), nor when each promise is resolved (this depends on the length of the task). However, it does guarantee that the order of promises in the output array is identical to the order of promises passed to it in the input array.

This:

  1. makes the doc specific to all, since the comment is added in the all section (if the documentation is more general, perhaps the extensions section is more appropriate);
  2. clarifies that the order of the returned object is clearly defined;
  3. adds details on why -all: does not control order of resolution.
jeff-h commented 4 years ago

Hey — I like it. It provides more detail than my attempt & would certainly have alleviated my initial misunderstandings on this. TBH when my brain is in the right space the situation re all is self-evident, so anything in the docs that prompts a deeper think would do the trick :)