Re: Sync API for workers

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