Russell Leggett wrote:
Another thing that I was also thinking is that it might look a little nicer if the ? was a post-fix instead of a pre-fix.

    let {first, last, company?} = contact;

I might be missing why this wouldn't work out, but it aesthetically just looks right to me. It looks like the regex operator, and is also obviously the position it would be in english.

We have to parse LHS-of-assignment patterns using the Expression cover grammar, so this does not work in general due to ?:.

If we parse only in binding contexts (let, const, var on the left, or formal params and catch clauses), then we could use a different pattern grammar. Worth breaking uniformity with assignment expressions?

/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to