W3C home > Mailing lists > Public > public-sysapps@w3.org > February 2013

Re: Concerns about DOMRequest

From: Marcos Caceres <w3c@marcosc.com>
Date: Fri, 15 Feb 2013 07:22:04 +0000
To: Jonas Sicking <jonas@sicking.cc>
Cc: Mounir Lamouri <mounir@lamouri.fr>, public-sysapps@w3.org
Message-ID: <275FAAAF64B147298D8FEA2AA4B18FEA@marcosc.com>

On Friday, 15 February 2013 at 05:08, Jonas Sicking wrote:

> On Thu, Feb 14, 2013 at 4:35 AM, Marcos Caceres <w3c@marcosc.com (mailto:w3c@marcosc.com)> wrote:
> > 
> > 
> > 
> > On Thursday, 14 February 2013 at 11:17, Anne van Kesteren wrote:
> > 
> > > On Wed, Feb 13, 2013 at 8:27 PM, Marcos Caceres <w3c@marcosc.com (mailto:w3c@marcosc.com)> wrote:
> > > > It would still really suck if you added .then() but still required everything to be wrapped in a function.
> > > 
> > > 
> > > 
> > > What do you mean by this?
> > 
> > In IDB, the design of the API forces a developer to do everything synchronously, even though the IDB operation is async in the background (you have to start an operation before you can set listeners on it - so developer are forced to do everything in one go inside a function). See the following, for example:
> > http://www.html5rocks.com/en/tutorials/indexeddb/todo/#toc-step2
> This is simply not accurate. DOMRequest doesn't force you to do
> anything synchronously that DOMFuture/Promises doesn't.

Right, it might be either designs not appropriate for the given use cases and APIs. Also, my statement holds in that I was not comparing it to DOMFuture or whatever. You still can't use the DOMRequest pattern in a JS console, for instance, because the way the APIs that rely on it are designed.
> DOMFuture/Promises provides the .then function which is *very* nice
> syntax sugar for handling asyncronous callbacks, especially when you
> need to nest multiple asynchronous actions. But it doesn't change
> anything about when any actions need to be taken.

> As you can see, the .then function on DOMFuture/Promises certainly
> makes the code cleaner and removes a lot of the syntax overhead. But
> the capabilities are exactly the same.

Cleaner code is good.  
> This is not to say that the .then function isn't important. It makes a
> huge difference. But if you have other problems with DOMRequest then
> those concerns likely applies to DOMFuture as well.

It may be that both are inappropriate for any particular API. What I'm advocating is not one over the other, but that each API be looked at independently and we use what is most appropriate (DOMRequest, DOMFuture, simple callbacks, an "intent", something new, whatever). My concern is that DOMRequest was being used on "all the things" as some kind of magic bullet:

"DOMRequest intend to be used instead of those callbacks to make those APIs more developer-friendly and help code readability." - [1][2]
As you just proved by comparing to DOMFuture, the above statement is wildly inaccurate and misleading. I'm asking that all the text about DOMRequest be removed from the Runtime document and that we assess the applicability of what is most appropriate on a case by case basis.

http://jungkees.github.com/sysapps/proposals/Runtime/Overview.html (http://jungkees.github.com/sysapps/proposals/Runtime/Overview.html#domrequest-interface) 
Received on Friday, 15 February 2013 07:22:37 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:36:11 UTC