LiveScript is a language which compiles to JavaScript. It has a straightforward mapping to JavaScript and allows you to write expressive code devoid of repetitive boilerplate. While LiveScript adds many features to assist in functional style programming, it also has many improvements for object oriented and imperative programming.
The minor code optimization of omitting parentheses around a single
destructuring assignment is incorrect when the assignment is produced
inside a binary expression, as the binary operator interferes with the
parsing of the assignment's LHS in the generated JS.
This change restricts the optimization to cases where the current
precedence level is lower than that of binary operators. Since the
number of expressions includes a final expression that captures the
original RHS of the destructuring assignment if that value is needed,
and since the optimization is always applied to top-level and
parenthesis-level expressions by the second half of the if condition,
this change only has an effect on single-assignment destructuring
assignments that are direct children of a list or conditional
expression, where the value of the destructuring assignment expression
is not used (which rules out lists and most conditionals as well). #1096
illustrates one of the only ways such a circumstance is likely to arise
in natural code.
Okay, it's been a minute, but same deal as always: as a tweak to a minor optimization, I'll hold this open for comments for one week, merging on or after Apr 23 if there are no objections.
The minor code optimization of omitting parentheses around a single destructuring assignment is incorrect when the assignment is produced inside a binary expression, as the binary operator interferes with the parsing of the assignment's LHS in the generated JS.
This change restricts the optimization to cases where the current precedence level is lower than that of binary operators. Since the number of expressions includes a final expression that captures the original RHS of the destructuring assignment if that value is needed, and since the optimization is always applied to top-level and parenthesis-level expressions by the second half of the if condition, this change only has an effect on single-assignment destructuring assignments that are direct children of a list or conditional expression, where the value of the destructuring assignment expression is not used (which rules out lists and most conditionals as well). #1096 illustrates one of the only ways such a circumstance is likely to arise in natural code.
Okay, it's been a minute, but same deal as always: as a tweak to a minor optimization, I'll hold this open for comments for one week, merging on or after Apr 23 if there are no objections.