On Wed, Jul 31, 2013 at 3:53 PM, Claude Pache <[email protected]> wrote: > Le 31 juil. 2013 à 20:23, "Tab Atkins Jr." <[email protected]> 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 [1]: 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. ~TJ _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

