Tab Atkins Jr.
jackalmage at gmail.com
Wed Jul 31 15:58:33 PDT 2013
On Wed, Jul 31, 2013 at 3:53 PM, Claude Pache <claude.pache at gmail.com> wrote:
> Le 31 juil. 2013 à 20:23, "Tab Atkins Jr." <jackalmage at gmail.com> a écrit :
>> The first issue still up for community discussion involves the
>> definition of "promise-like".
>> We'd like the definition to be: (a) a Promise or subtype, or (b) a
>> branded non-Promise (with the branding done via Symbol or similar).
>> Promises/A+ wants the branding to be done via a method named "then"
>> (the "thenable" concept).
> I suggest an @@isPromise builtin symbol, which works the same way as
> @@isRegExp in the ES6 spec : An object is reputed to be a promise if and
> only if it has a property (either own or inherited) named @@isPromise. And
> `Promise.prototype` has initially an @@isPromise own property, so that
> instances of subclasses of `Promise` are recognised as promises.
> (With this solution, you have not to choose between subclassing or branding,
> but you have the both. :-) )
The "or" up there wasn't meant to be an exclusive or. We intend
either of them to be possible. Yes, symbols on the prototype gets you
there with a single mechanism.
More information about the es-discuss