What are the reasons behind this spec choice?
As Ben points out in the comments, the idea of the Promises/A+ specification is not to provide some sort of library API. It's to provide a minimum interoperable set of primitives so that anyone who consumes a promise can depend on it having a uniform interface. This is especially important for cross-library interop e.g. at the seams of different components of an application, where different promise libraries may be in use internally. Specifying the full API for a promise library isn't really necessary to meet this goal.
Is there some license-free minimum viable promise A+ library that we can embed in our libraries or something?
There are many Promises/A+ implementations. I don't think any of them are license-free, which is a good thing, because then they'd be by default all rights reserved by their authors. Most (all?) of them are open-source licensed, though, which should be fine.
How a library author is supposed to create the promises he exposes to the API without coupling to the implementation?
I literally do not understand how this would be possible. If you rephrase this question, you are asking, "how do I create a promise, without using a promise implementation?" That's just plain not possible.
- I want to expose a promise-based API
- I want the client to choose the promise implementation he wants to use
This goal, on the other hand, is a different story. If you want to allow people to choose promise implementations, then there are a couple easy options.
First, just return a promise of any implementation; the consumer can convert it to their preferred one using their library's coercion methods. E.g. if your library returns a when promise and I, the consumer, want a Q promise, I can just do Q(yourLibrary.getPromise())
.
Alternately, you could allow any library that follows the Promises/A+ constructor proto-spec. This is largely a de-facto standard by now; most major libraries, including the promises built into ES6, follow that specification. So for example you could allow users to do yourLibrary.Promise = Q.Promise
, and then inside your library use the assigned promise constructor to create promises.