If you really like the idea of syntactic partial application in your JavaScript, you should check out the stage 1 tc39 proposal for exactly that: <a href="https://github.com/rbuckton/proposal-partial-application" rel="nofollow">https://github.com/rbuckton/proposal-partial-application</a>
It's slowly being worked through the committee, so if you care enough about the feature, you should consider voicing your support.
Funny, I already kinda use partial application in Javascript, just by using curried functions a lot. I.e.<p>const add = x => y => x + y<p>This is definitely non-idiomatic, but the definition syntax itself doesn't look that bad, if you can stomach writing add(1)(2) to use it.<p>I do agree that using _ would probably be a better solution :-)
> In Kotlin specifically, this is a shorthand for anonymous functions where, if you don’t specify an argument, one will automatically exist with the name <i>it</i><p>I'm pretty sure Kotlin borrowed this idea from Groovy.
Hi everyone, I'm the author. Looks like I'm a little late to the party (this post snuck by me) but I'll try to answer any questions you might have.<p>I'd also like to point out the online playground [0] which allows you to use this directly in your browser and see what it compiles to.<p>[0]: <a href="https://citycide.github.io/param.macro" rel="nofollow">https://citycide.github.io/param.macro</a>
Nice article. I still prefer arrow functions over positional arguments though, because this approach trades some clarity for syntactic sugar. Until partial application becomes part of JavaScript, the import statement will probably outweigh the informative "boilerplate" it helps obscure anyway (there's rarely more than one use case for partial application inside a well-factored component).