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

Resolver API should hide resolve() #55

Closed
cowwoc opened this issue May 30, 2013 · 5 comments
Closed

Resolver API should hide resolve() #55

cowwoc opened this issue May 30, 2013 · 5 comments

Comments

@cowwoc
Copy link

cowwoc commented May 30, 2013

I'd like to propose the following design change:

Invoking accept from a Resolver invokes a hidden method resolve if there are any chained Resolvers, otherwise it invokes another hidden method finalAccept.

This way users would only have to be aware of accept and reject. Currently we require users to invoke resolve which I found to be very confusing. I shouldn't have to invoke different methods depending on whether chaining is taking place or not; that should be an implementation design.

@slightlyoff
Copy link
Owner

The semantics of accept and resolve are different, and accept is the lower-level variant. It sounds like your suggestion is to give accept (now fulfill) the resolve semantics and move the accept semantics to finalAccept?

I'm not sure what that buys us. There is active disagreement about weather or not programmers should use accept or resolve, and removing one or the other is hostile to at least one camp.

@cowwoc
Copy link
Author

cowwoc commented Jun 7, 2013

@slightlyoff,

When would a user ever need to invoke fulfill directly? Shouldn't users always invoke resolve?

@neonstalwart
Copy link

@cowwoc the semantics are different - resolve will unwrap/resolve promises passed as the value whereas fulfill just blindly takes the value it's given and passes it along.

  // Directly resolves the Promise with the passed value
  void fulfill(optional any value);

  // Indirectly resolves the Promise, chaining any passed Promise's resolution
  void resolve(optional any value);

@cowwoc
Copy link
Author

cowwoc commented Jun 7, 2013

So you're saying fulfill() causes the promise to override any values returned by subsequent chains? Why/when when you want to do that?

@neonstalwart
Copy link

Why/when when you want to do that?

see #53 (and i think #26 as well and maybe another or maybe it was in various other places) - a lot of ground has already been covered in those tickets.

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

3 participants