tc39 / proposal-partial-application

Proposal to add partial application to ECMAScript
https://tc39.es/proposal-partial-application/
BSD 3-Clause "New" or "Revised" License
1.02k stars 25 forks source link

Update explainer to introduce `~()` for partial application #49

Closed rbuckton closed 3 years ago

rbuckton commented 3 years ago

This make the following changes to the proposal:

Fixes #48 Fixes #43 Fixes #5

jonatjano commented 3 years ago

I see no mention of what happens when you use the same ordinal placeholder multiple times

const surround = String~(?1, ?0, ?1);
surround("text", "__"); // "__text__" ?

The explainer doesn't say if it is forbidden or if the argument is applied twice as expected (Or did I overlook it ?)

tabatkins commented 3 years ago

You overlooked it - check line 115.

rbuckton commented 3 years ago
const surround = String~(?1, ?0, ?1);
surround("text", "__"); // "__text__" ?

Although, the String constructor doesn't work that way. I think you would want "".concat(?1, ?0, ?1) instead.

rbuckton commented 3 years ago

Merging, thanks for the feedback!