1

In the Promises/A+ standard, I am wondering if a promise needs to resolve or reject eventually. By this I mean a promise X with the property that under no condition whatsoever will X get resolved or rejected.

Promises/A+ states

  1. When pending, a promise:

    i. may transition to either the fulfilled or rejected state.

It is the may part that is the ambigious too me. I do not know whether to read it as saying "It may transition but may not" or that it will transition eventually and it may transition to fulfilled or rejected.

Lan
  • 1,206
  • 1
  • 11
  • 26
  • I'm just guessing here, but I think you can keep it pending as long as you want, and that there is no requirement that says you *have* to resolve it. The question is why wouldn't you? At least in your code, if the user leaves before it's resolve/rejected, it's a different matter. – adeneo Dec 15 '15 at 12:42
  • 2
    If you don't resolve or reject your promise, then you're a `liar` and should be using `FalsePromise()` instead. – Arg0n Dec 15 '15 at 12:45

1 Answers1

1

No, the spec does not mandate this. There is no restriction on how long a promise should take to settle. And that includes an infinitely long time - known as a never-resolving/never-settling promise or forever-pending promise. (see also promise terminology)
The term may is used deliberately here, and does carry the conventional meaning.

There even exist promise implementations that offer a Promise.never primitive (e.g. in creed) to optimise the memory consumption for the case when you know that your promise won't settle.

Community
  • 1
  • 1
Bergi
  • 630,263
  • 148
  • 957
  • 1,375