W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2012

Re: Sync API for workers

From: Glenn Maynard <glenn@zewt.org>
Date: Tue, 4 Sep 2012 13:47:13 -0500
Message-ID: <CABirCh_T5n_Dusu5Cctz1PEtchbkVWy_jeMN-QW8eNVVC_bL_Q@mail.gmail.com>
To: David Bruant <bruant.d@gmail.com>
Cc: Jonas Sicking <jonas@sicking.cc>, "public-webapps@w3.org" <public-webapps@w3.org>
On Tue, Sep 4, 2012 at 12:49 PM, David Bruant <bruant.d@gmail.com> wrote:

> I'm sorry, but I have to disagree. Have you ever used promises in a
> large-scale project?
> I've been amazed to discover that promise-based API are ridiculously much
> easier to refactor than callback-based API. Obviously, refactoring
> necessitates well-scoped state. I can't show the commit I have in mind,
> because it's in closed-source software, but really, a promise-based API
> isn't less understandable and less well-scoped. That statement is at the
> opposite direction of my experience these last 8 months.

You have to choose between scoping state to a class (poor scoping) or in
closures (hard to debug) instead of using locals in a call stack (tightly
scoped and easy to debug); the overall current state of execution is much
harder to see compared to a stack trace; the basic idea of stepping through
code in a debugger scarcely translates at all.

 I understand and agree, but you're not addressing the problem of the
> resource waste I've mentionned above.

I don't feel like I need to, because I expect this question was explored
before workers were introduced in the first place.  You apparently want to
argue against *all* sync APIs, but you should do that separately, rather
than singling out one sync API at random.

Glenn Maynard
Received on Tuesday, 4 September 2012 18:47:41 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:38 UTC