arrow function syntax simplified
lukeh at microsoft.com
Tue Mar 27 16:01:28 PDT 2012
>>>> I think fully TCP- compliant do expressions are pure win, FTR.
>> I second this, of course, based solely on the experience I had writing up these examples:
Looking through those examples, I don't see any cases where TCP-compliant do expressions are actually needed. In the original arrow proposal, I believe all the code would be the same, except 10 or so occurrences of "=> do" would become just "=>". These examples seem to support the simpler approach of the original arrow proposal.
Note that the => is what provides lexical this binding in the body. The do expressions serve a separate purpose of changing the meaning of return (but not break and continue), and allowing use of completion results as returns (which tends to look a bit awkward in curly brace languages, and I don't believe was used in any of the examples linked above though it's hard to tell for sure due to completion value leak).
More information about the es-discuss