Closed cowwoc closed 11 years ago
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.
@slightlyoff,
When would a user ever need to invoke fulfill
directly? Shouldn't users always invoke resolve
?
@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);
So you're saying fulfill() causes the promise to override any values returned by subsequent chains? Why/when when you want to do that?
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.
I'd like to propose the following design change:
Invoking
accept
from aResolver
invokes a hidden methodresolve
if there are any chainedResolvers
, otherwise it invokes another hidden methodfinalAccept
.This way users would only have to be aware of
accept
andreject
. Currently we require users to invokeresolve
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.