On Sat, Dec 7, 2019 at 2:01 PM <[email protected]> wrote:
>> I do find it surprising that property access isn't addressed there,
>> but it seems like it was likely just overlooked - it has no mention in
>> the repo, in the open issues, or even in the closed issues or any of
>> the open or closed pull requests.
>
> Actually, they do seem to address it here as a non-goal:
> https://github.com/tc39/proposal-partial-application#support-for-receiver-placeholder
>
> If we had that, then we wouldn’t need a specific syntax for property 
> accessors. However, arrow functions are already pretty compact, so I don’t 
> feel a strong desire for this `receiver placeholder` syntax or something like 
> Kotlin’s `it`. I know the same logic applies to a `property accessor` 
> proposal, but accessing properties in JS is extremely common and in my 
> opinion, deserving of a syntax shorthand.

Yes, in general, unfortunately, the partial-application proposal
doesn't help with partially applying operators (note in their examples
that they explicitly use an add() function, since you couldn't use +
with it). You'd have to jump to the competing pipeline proposal for
that; `+>#.foo` is the shortest way to spell it there.

I agree that `x=>x.foo` is a very small syntax tax to pay to create an
accessor function; I haven't found it problematic to do so in my own
coding.

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

Reply via email to