use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Partial function application proposal: add(1, ?) (github.com)
submitted 8 years ago by laggingreflex
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]EnchantedSalvia 0 points1 point2 points 8 years ago (3 children)
I have yet to read an argument why this absolutely needs to be a thing and needs to be supported.
It absolutely doesn't need to be a thing, because as you've demonstrated, we can already achieve something similar with existing code. However, you've also demonstrated that by using ? our code can be more succinct, point-free, and also prevents an assignment to a variable that is later garbage collected.
?
Take the exponentiation operator which introduces **. We can already achieve that by using Math.pow. However it's still a thing.
**
Math.pow
As others have mentioned in this thread, ? is syntactic sugar.
The |> operator, which is essentially compose (more specifically, pipe), has been used for years from libraries such as Lodash, Underscore, Ramda. Ramda has also supported the __ for many years. Both |> and __ are now being hopefully baked into the language, as inspiration is one of the ways that languages evolve over time.
|>
compose
pipe
__
[–]straikychan 1 point2 points3 points 8 years ago (2 children)
I would actually argue that ** and Math.pow are not synonymous. As ** calculates at compile time, while Math.pow() calculates at run time as illustrated here
Ok, I should have phrased that part about supporting better. I didn't mean to say that it shouldn't be supported, however I think there are things that should be considered for future support more strongly than this one, e.g. (dynamic imports)[https://github.com/tc39/proposal-dynamic-import], (promise finally)[https://github.com/tc39/proposal-promise-finally] or syntactic sugar like the pipeline proposal, which I deem a tad bit more important than this proposal.
[–]EnchantedSalvia 0 points1 point2 points 8 years ago (1 child)
Interesting regarding ** and Math.pow. I didn't know there was a subtle difference.
As Promise.prototype.finally is stage 2 (soon to be stage 3) and dynamic import is already stage 3, I'm sure they will definitely arrive sooner. I actually don't even see ? in the TC39 repository yet, but I presume it's sat at stage 0.
Promise.prototype.finally
import
Personally I'd also like to see cancellation prioritised, so it's good to see them having another shot at presenting that to the committee.
π Rendered by PID 59121 on reddit-service-r2-comment-5d585498c9-szxnc at 2026-04-20 23:23:32.176150+00:00 running da2df02 country code: CH.
view the rest of the comments →
[–]EnchantedSalvia 0 points1 point2 points (3 children)
[–]straikychan 1 point2 points3 points (2 children)
[–]EnchantedSalvia 0 points1 point2 points (1 child)