-
Notifications
You must be signed in to change notification settings - Fork 165
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
change "if x is a promise" to something non-circular and clear #240
Comments
I think one reasonable possible resolution would be to change "If x is a promise, adopt its state [3.4]:" Even though this is still self-referential, I believe this will make it clear and meaningful. In particular, the questions of whether the 6 SOMETHING(x) functions shown at the end of my original post are conformant can then be answered: NO, NO, YES (assuming we trust the two implementations are conformant to the entire spec), YES, NO, NO. |
If you feel this can be made more clear, perhaps you can submit a pull request? |
Thanks @ForbesLindesay . From what you're saying, it looks like my interpretation of this clause is correct. I'll put together a pull request with the wording I suggested in my previous comment, maybe also adding some of your words to footnote 3.4. |
Also added some more words of clarification of intent to footnote 3.4, loosely based on discussion with ForbesLindesay. Closes promises-aplus#240.
Mention `x instanceof Promise` as an example of the kind of check being suggested. This is a further improvement for promises-aplus#240.
More polishing for promises-aplus#240: implementations SHOULD (not MAY) optimize the case when x is known to be a promise, per discussion with @bergus.
I made the pull request (#241) and revised it a few times based on review discussion. I'm now very happy with it; I think it completely resolves the problem. For reference, the proposed new wording is:
It looks to me like @ForbesLindesay, @bergus, and @briancavalier are on board with the above proposed new wording.
So we're back to the question of whether to make any change here at all. @domenic, I get that you think this part of the spec is good enough and not worth putting much more thought into. The others (@ForbesLindesay, @bergus, @briancavalier) have put thought into it, and they've arrived at this tighter version of this section that I think is really good and completely resolves the issue. Unless you actually think this change makes it worse overall, would you be willing to let the change through? Here's why I think it's important. The world is learning how promises work, in large part through discussions that refer to the promises/A+ spec, since it's the primary and best reference. In fact, it's the only reference that has the level of precision and completeness that's appropriate and useful for most of these discussions. (In contrast, the ES6 promises spec, for example, in addition to being implementation-specific, uses language that is too complicated and convoluted for it to be useful in resolving most of the questions I've seen.) In particular, the wording of this section becomes significant when I discuss your spec with people, e.g. when asking or answering questions on stackoverflow, or if I write an implementation, or when I review someone else's implementation.
which is kind of wordy and embarrassing. Acknowledged, people have managed to implement it many times in spite of this hurdle, and maybe all of them even inferred your intent correctly-- I haven't checked. In any case, after this change, I'll be able to say the following instead, which I very much prefer:
That's a significant reduction in noise and distraction which will increase the quality of the global discussion, and it will also reflect better on you and on the great work you've put into this project. What do you think? Will you let it through? |
@ForbesLindesay, what is the status of this? My reading of what has happened so far is
Does this depend on domenic? @ForbesLindesay, would you be able to accept the pull request? |
I am paying attention and my objection stands. |
Hi Domenic, Great that you're paying attention. Please give an argument supporting your "I don't think the spec is ambiguous" that addresses the issue and the replies I've given you so far. Your offhand dismissal without explanation is unhelpful and comes off as disrespectful of the thought and work that I and the others have put into describing and attempting to address the issue. Your "people haven't had any issues implementing it many times." is specious, and (even if reworded without the hyperbole), I suspect, false. I ask you to either start engaging thoughtfully and respectfully, or get out of the way. |
The promises/A+ spec currently has a clause saying "If x is a promise, adopt its state [3.4]:"
where footnote [3.4] is: "Generally, it will only be known that x is a true promise if it comes from the current implementation. This clause allows the use of implementation-specific means to adopt the state of known-conformant promises."
Notice that, according to the earlier definition of "promise", "If x is a promise" means "If x is an object or function with a 'then' method whose behavior conforms to this specification", where "this specification" includes the clause in question.
In other words, the definition of "promise" is circular.
If [3.4] is an attempt to clarify, it fails.
The clause in question should be changed to something non-circular and clear:
In other words, if it's intended that the implementation has latitude here, then clearly say how much latitude,
so that it will be meaningful to ask, and possible to tell, whether any particular straightforward implementation of SOMETHING(x)
is conformant or not from looking at the source code.
In particular, it should be possible to discern whether each of the following possible
implementations of the boolean function SOMETHING(x) is conformant:
function(x) { return typeof(x.then) == 'function'; }
function(x) { return typeof(x.then) === 'function'; }
function(x) { return x instanceof SomePromisesImplementation.Promise || x instanceof SomeOtherPromisesImplementation.WhateverItCallsAPromise; }
function(x) { return false; }
function(x) { return true; }
function(x) { return Math.random() >= 0.5; }
The text was updated successfully, but these errors were encountered: