yield* desugaring

David Herman dherman at mozilla.com
Mon May 13 22:20:27 PDT 2013

On May 13, 2013, at 4:15 PM, David Herman <dherman at mozilla.com> wrote:

> On May 13, 2013, at 11:07 AM, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:
>> It closes down this whole edge-case focused discussion and that's valuable in itself.  Also, since it turns try {yield expr} finally{} into a syntax error  we could revisit the decision in a future edition if somebody actually comes up with compelling use cases.
> I'm very uncomfortable with this restriction. Ad hoc restrictions break compositionality. They come back to bite you because you broke generality for want of use cases, when we all know we can't predict all the use cases of a general-purpose programming mechanism. This gets our responsibility backwards: ad hoc restrictions that break generality should be extremely strongly motivated, rather than requiring use cases for the semantics they disallow.

And what was I thinking, of course there are use cases: anything where you'd use try/finally in a language with synchronous I/O, you would use try/finally in task.js.

  spawn(function*() {
    let splashScreen = $("splash");
    try {
      splashScreen.style.display = 'block';
      let assets = yield downloadAssets();
      // ...
    } catch (e) {
      // ...
    } finally {
      splashScreen.style.display = 'none';


More information about the es-discuss mailing list