Allen Wirfs-Brock (2015-02-23T16:40:19.000Z)
d at domenic.me (2015-03-06T00:49:32.950Z)
We actually explored this alternative quite extensively prior to adopting arrow functions and had "block lambdas" with label support pretty much fully spec'ed. What killed them for me wasn't issues involving BLs that outlived their home function, that was easy enough to deal with. The major problem was the complexity involved in making labelled early exit syntax (break and particularly continue) work as might be expected when used in the context of control abstraction functions. For example, consider: ```js for (v of O) { CtlLib.doWhile(()=>true, () { if ( condition1(v) break; if (condition2(v) continue; //do something here }); } ``` or ```js outer: for (v of O) { inner: CtlLib.doWhile(()=>true, () { if ( condition1(v) break outer; if (condition2(v) continue inner; //do something here }); } ``` What should happen for the 'break' and 'continue'? What will a programmer think should happen. If we really are claiming TC for such arrows, then presumably programmers should be thinking about abstractions like CtlLib.doWhile as being on the same footing as built-in syntactic control structures such as the 'while' statement. In that case, a reasonable (more strongly put, necessary) expectation is that unlabeled break/continue must refer to the closest enclosing control structure which is the DtlLib.doWhile. To make that work, means that the control abstraction function must have an opportunity to define what it means for it to 'continue' . Accomplishing that requires coming up with a way for reify the specification's "completion value" mechanism and labeling semantics so that the JS code can intercept and respond to them. For example, it probably requires some like a labelledArray(labelSet, thisValue, args) function for invoking a function with the intent of receiving a reified completion value. There were also issues relating to possible interactions between labeled syntactic control structures used by the control abstraction function itself and the use of labels and early exits by the consumer of the control abstract. This would have added significant complexity to the language. It also adds significant complexity for the implementors of control abstraction functions. For me, at least, this passed the point of diminishing returns. There is a fork in the road of language design, you can take the fork of c-style syntactic control structures with labeled early exits. Or you can take the path of user definable control abstraction functions built upon TCP. Each path works well, within the bounds of its particular limitations. But trying to rejoin those two paths in a manner that combines all the features of both leads you into a complexity swamp.