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 code
([{foo}?]) ->
produces following output:Which fails to evaluate because of
&&
before assignment.At the same time,
([{foo, bar}?]) ->
doesn't fail, because resulting output is taken in parens:More to the point, optional object with alternative (
([{foo}={}]) ->
) doesn't fail either, because there's no right-side assignment:And adding more fields (
([{foo, bar}={}]) ->
) results in a comma chain, as usual: