- From: Tobie Langel <tobie@fb.com>
- Date: Fri, 15 Mar 2013 08:58:27 +0100
- To: Jarred Nicholls <jarred@webkit.org>
- CC: Alex Russell <slightlyoff@google.com>, "Tab Atkins Jr." <jackalmage@gmail.com>, Glenn Maynard <glenn@zewt.org>, "public-webapps WG" <public-webapps@w3.org>
On Friday, March 15, 2013 at 4:11 AM, Jarred Nicholls wrote: > On Thu, Mar 14, 2013 at 10:19 PM, Alex Russell <slightlyoff@google.com (mailto:slightlyoff@google.com)> wrote: > > > On Thu, Mar 14, 2013 at 6:36 PM, Glenn Maynard <glenn@zewt.org> wrote: > > > > > > > Workers exist > > > explicitly to allow you to do expensive synchronous stuff without > > > janking the main thread. (Often, the expensive synchronous stuff will > > > just be a bunch of calculations, so you don't have to explicitly break > > > it up into setTimeout-able chunks.) > > > > > > The entire reason for most async (all?) APIs is thus irrelevant in a > > > Worker, and it may be a good idea to provide sync versions, or do > > > something else that negates the annoyance of dealing with async code. > > > > My *first* approach to this annoyance would be to start adding some async primitives to the platform that don't suck so hard; e.g., Futures/Promises. > > +1. Libraries cover that fairly well; albeit I think we all would enjoy such things to be first-class citizens of the platform. I've seen some good looking implementations and some decent control flow libraries. I use https://github.com/caolan/async a lot in node projects. > > > Saying that you should do something does not imply that doubling up on API surface area for a corner-case is the right solution. > > I agree. It may have seemed like a good and simple idea at first - well intentioned for sure - but upon reflection we have to admit it's sloppy, a greater surface area to maintain, and the antithesis of DRY. It's not what I personally would expect from a modern, quality JS api, and I'm probably not the only web dev to share that feeling. At the risk of making a blanketed statement using anecdotal evidence, I would claim that overindulgence from modern libraries in existence today has raised the expectations of web devs in how the web platform architects new apis. Node.js comes with sync and async APIs (for good reasons) and I haven't heard anyone complain that this wasn't DRY. --tobie
Received on Friday, 15 March 2013 08:05:14 UTC