Mark S. Miller (2014-01-09T16:17:49.000Z)
domenic at domenicdenicola.com (2014-01-14T17:49:36.615Z)
On Thu, Jan 9, 2014 at 6:18 AM, Andreas Rossberg <rossberg at google.com>wrote: > Interesting. I have the exact opposite expectation. And I don't see > what good it would do usability-wise. Now that we have `const` and `let`, `var`s serve no usability purpose whatsoever. However, given their existence in the language, the best we can do with them usability-wise is to follow the principle of least surprise. Since we have opposite surprise reactions, this doesn't tell us what to do, but at least we should be able to agree on this criterion. > It's not only the brevity as such, but having a natural, targeted > language feature. IIFEs are merely an encoding, and as such a > distraction. Like A + -B is brief enough, but I'm sure you prefer > saying A - B. In a language with infix + and unary -, *and the absence of prior expectations of an infix -*, the pressure to add an infix minus is small for exactly this reason. A repeated pattern often comes to be perceived as a phrase. In the absence of infix minus or prior expectations, A + -B would rapidly become seen to do what it does. I do have one usability concern with arrow IIFEs. I hate when I see them written as `()=>{...whatever...}()` because you don't know that it's an IIFE until the end. Function expressions have the same issue. We should adapt Crock's recommended paren style to arrow IIFEs, to whit `(()=>{...whatever...}())`, even though this looses a bit more brevity. > Can you clarify what you mean by "repair"? I hope you don't suggest > that `while (true) { (() => do { break })() }` should magically work. No, I am not suggesting that code within the `do` block is TCP wrt the context outside the function containing the `do` expression. This would be a TCP violation wrt the context of the `do` expression. Rather, I suggest that the following must work: ```js while (true) { do { break; } } ```