Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Partial application and currying #7

Closed
zloirock opened this issue Oct 3, 2021 · 1 comment
Closed

Partial application and currying #7

zloirock opened this issue Oct 3, 2021 · 1 comment
Labels
documentation Improvements or additions to documentation question Further information is requested separate proposal Deferred to a separate proposal

Comments

@zloirock
Copy link

zloirock commented Oct 3, 2021

What do you think about something like that:

// partial application without binding `this`, unlike `.bind`
((a, b) ==> a + b).partial(1)(2) // => 3
(function (a, b) { return this + 1 + 2 }).partial(2).call(1, 3) // => 6

// curring
((a, b) ==> a + b + c).curry(1)(2)(3) // => 6
@js-choi js-choi added the question Further information is requested label Oct 3, 2021
@js-choi
Copy link
Collaborator

js-choi commented Oct 4, 2021

Unfortunately, I am reluctant to include a currying function in this proposal. Programming styles involving heavy currying have been quite controversial in TC39 (performance concerns, ecosystem-schism concerns, aesthetic concerns, etc.); see tc39/proposal-pipeline-operator#221.

I anticipate that including a Function.curry would reduce the chances of this entire proposal advancing. So I’m going to avoid including anything that TC39 would perceive as benefiting or encouraging currying-heavy styles. I would push curry to another proposal, if this first proposal succeeds.

I’m holding off on Function.partial to avoid stepping on the toes of @rbuckton’s partial-function-application syntax proposal. We could always add Function.partial later. First steps.

It might be would be worth calling this out in the explainer sometime; I’ll close this issue when I add that to the explainer. Anyways, sorry if this isn’t the answer you wanted.

@js-choi js-choi added documentation Improvements or additions to documentation separate proposal Deferred to a separate proposal labels Oct 4, 2021
@js-choi js-choi changed the title Partial application and curring Partial application and currying Oct 4, 2021
@js-choi js-choi closed this as completed Oct 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation question Further information is requested separate proposal Deferred to a separate proposal
Projects
None yet
Development

No branches or pull requests

2 participants