RE: Re: Proposal: Selector/Select Expression

2019-06-27 Thread Simon Farrugia
Also, without a leading token, a selector expr with the optional chaining operator inside a ternary operator would be ambiguous. ``` const contactSelector = true ? .contacts.email : .contacts.phone; ``` From: Isiah Meadows Sent: 27 June 2019 19:18 To: Michael Luder-Rosefield Cc: Simon Farrugia

Re: Proposal: Selector/Select Expression

2019-06-26 Thread Simon Farrugia
I think you are misinterpreting the intent of the proposal. It is not intended to handle logical expressions, that's way I called it Selector Expression :-) ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Proposal: Selector/Select Expression

2019-06-26 Thread Simon Farrugia
I'ld say, if there is no valid reason why a wildcard is required for the feature to actually work we should not add any. Else we would be just be depriving future features from using that symbol. Also, it does start to look a bit crowded with symbols if you consider the optional chaining operator.

Re: Re: Proposal: Selector/Select Expression

2019-06-23 Thread Simon Farrugia
I was expecting that someone brings up the brackets property accessor at some point. I would argue that there is a bit of syntactic inconsistency since usually when using the bracket accessors it is not preceded by a dot. ``` const getEmail = user => user["contacts"].email; // No dot between user

Re: Re: Proposal: Selector/Select Expression

2019-06-22 Thread Simon Farrugia
Using a recursive Proxy to achieve this is a really smart @Barret. Having said that, a recursive proxy implementation would surely not be possible without taking a significant performance hit. Thus, I don’t think Proxies are ideal for anything that is meant to be widely used throughout the cod

Re: Re: Proposal: Selector/Select Expression

2019-06-21 Thread Simon Farrugia
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. Reas

Re: Proposal: Selector/Select Expression

2019-06-21 Thread Simon Farrugia
#x27;d still need to reference `users`. > Otherwise what are we mapping? > > > ``` > > const getEmailsList = users.map(.contacts.email); > > ``` > > On Fri, Jun 21, 2019, 4:49 AM Simon Farrugia > wrote: > >> Selector/Select Expression >> >> &g

Proposal: Selector/Select Expression

2019-06-21 Thread Simon Farrugia
Selector/Select Expression Doing functional & reactive programming is currently really verbose in JavaScript. Hopefully this issue will be alleviated with the addition of the pipe operator in the near future. One things you end up doing most when doing fp is doing simple selections (mappings