W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2013

Re: A Challenge Problem for Promise Designers

From: Sam L'ecuyer <sam@cateches.is>
Date: Fri, 26 Apr 2013 17:16:57 -0400 (EDT)
To: "David Bruant" <bruant.d@gmail.com>
Cc: "Domenic Denicola" <domenic@domenicdenicola.com>, "Rick Waldron" <waldron.rick@gmail.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>, "es-discuss" <es-discuss@mozilla.org>
Message-ID: <1367011017.40225281@apps.rackspace.com>

> I believe "does this object has a 'then' method?" is too weak of a 
> heuristic for a web platform convention. Trying an idea:
> Step 2.3 of the Promise Resolution Procedure, instead of just "if then 
> is a function", what about "if then is a function *and* has a property 
> named '__IAmAPromiseA+Thenable__' which value is true, call it... "?

I agree.  This is actually exactly the approach Kris Kowal took with his Promises/B 
approach, separating "isPromise" from "isPromiseAlike", where isPromiseAlike
is simply a thenable to be assimilated.

>> I don't think it would be possible (you'll tell me soon enough I 
> imagine), but that would be better.

Unfortunately, his spec did not cover how to determine isPromise. Q uses
a non-spec'd method to check against, but something like a read-only property
makes sense to me.

> Although this sounds crazier, it's a much better way to express the 
> intent that such then function is a thenable and I wouldn't be opposed 
> to this test even baked in the platform as it dramatically reduces the 
> risk of confusion.

I agree.

-sam
Received on Friday, 26 April 2013 21:17:24 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:49 UTC