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

isResolved should be named isFulfilled #1

Closed
julien-f opened this issue Mar 10, 2017 · 12 comments
Closed

isResolved should be named isFulfilled #1

julien-f opened this issue Mar 10, 2017 · 12 comments

Comments

@julien-f
Copy link

AFAIU, resolved means that the promise is fulfilled (has a value) or is chained to another promise (which might not be settled).

@iamstarkov
Copy link

afaik, isFullfilled = (isResolved || isRejected)

@julien-f
Copy link
Author

julien-f commented Mar 10, 2017

Nope, that's (almost) settled.

isSettled = isFulfilled || isRejected

And in fact, resolved is even an alias for settled (source).

isResolved = isSettled || isChainedToOtherPromise

@iamstarkov
Copy link

you are right
screen shot 2017-03-10 at 12 31 33

@jamiebuilds
Copy link
Owner

We don't currently expose the word fulfilled anywhere in the Promise api. Promise.resolve is exposed though.

@ljharb
Copy link

ljharb commented Mar 10, 2017

That difference is because resolving is a verb that can include resolving to another promise's state - although I prefer the term "resolve" here, "fulfill" is indeed correct. This has its roots in E's promises.

The spec's intention was for the new Promise executor's arguments to be named "fulfill, reject" - altho the community tends to call them "resolve, reject".

@jamiebuilds
Copy link
Owner

jamiebuilds commented Mar 10, 2017

My point was that the name of the argument is not exposed as either fulfill or reject. The only place a name is exposed is Promise.resolve and I would rather match that naming.

@ljharb
Copy link

ljharb commented Mar 10, 2017

Right, but "is resolved" doesn't mean the same thing as "is fulfilled", and Promise.resolve does not guarantee you get a fulfilled promise - Promise.resolve(pendingPromise) gives you a pending promise. Thus "is resolved" isn't actually useful, since all that tells you is that the Promise's state is either fulfilled, rejected, or delegated to another Promise. "is fulfilled" is what tells you that it is irrevocably settled with a non-rejection.

@domenic
Copy link

domenic commented Mar 15, 2017

The spec's intention was for the new Promise executor's arguments to be named "fulfill, reject" - altho the community tends to call them "resolve, reject".

False. The resolve() argument resolves, not fulfills, e.g. try resolve(Promise.reject(new Error())).

@ljharb
Copy link

ljharb commented Mar 15, 2017

Oops, you are indeed correct. Is the rest of my statement still accurate?

@domenic
Copy link

domenic commented Mar 15, 2017

Yeah

@jamiebuilds
Copy link
Owner

Changed api and used fulfilled

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

No branches or pull requests

5 participants