Mark S. Miller wrote:
My other suspicion: The previous failure of this proposal was before many people had much hands on experience using higher order functions in JS as a normal alternative to control structures. Now that we all have, the need for a non-local escape may be more visceral.

Just in case anyone wants my historical two cents, I don't think this is true. I championed both

http://wiki.ecmascript.org/doku.php?id=strawman:block_lambda_revival

and

http://wiki.ecmascript.org/doku.php?id=strawman:arrow_function_syntax

starting well after (spring 2011) the modern (Prototype.js, 2005?) higher-order function revival in JS.

Anyway, however much more momentum there is today compared to four years ago, we still don't have a clear winner. But we've been over this ground. I dug up some more links in a few minutes of site: googling.

Dave Herman proposed return to label here:

http://wiki.ecmascript.org/doku.php?id=strawman:return_to_label

This led to (among others):

https://esdiscuss.org/topic/march-24-meeting-notes#content-13

where Andreas Rossberg proposed `return from` to address the problem cited in this thread's o.p. His example used forEach, but no matter:

  function f(o) {
    o.forEach(function g(x) {
       if (...) return 0 from f;
       let x2 = x.map(function h(y) {
         if (...) return from g
         return y*2  // returns from h
       })
       ...
    })
    return 27
  }


/be
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to