Proposal: Selector/Select Expression

Simon Farrugia simonfarrugia26 at gmail.com
Fri Jun 21 16:47:25 UTC 2019


New syntax will always look a bit odd at first until we get used to it.

I sometimes find nested arrow functions a bit confusing to understand where
one function starts and where it ends particularly when they are one liners.
This syntax is more concise and personally I find it more readable.

Reasons for the leading dot notation is because I think it's intuitive and
also self explanatory:
1) We just remove what is in common on both ends of the expression (like
simplifying an algebraic expression).
```
const getEmail = user => user.contacts.email;
```
2) The leading dot indicates that the expression reads the property of an
object that is not statically defined.
```
const getEmail = .contacts.email;
```
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20190621/94880480/attachment.html>


More information about the es-discuss mailing list