News for hackers. Stuff that matters.
Re:Faster JavaScript Calls by RReverser on Monday February 15, 2021 @06:12PM (#26148909)
> already uncommon

It's definitely not uncommon though. Just to provide one example: how often do you use all the arguments to `.map` callback?

Usually you'd write something like `arr.map(x => x + 1)`.

However, to spell out all the arguments you'd have to write `arr.map((x, i, arr) => x + 1)`.

And there's tons of other functions like that in stdlib or 3rd-party libs that people use without passing or accepting all the args. That's why this optimisation is so useful.

Re:Faster JavaScript Calls by skrebbel on Tuesday February 16, 2021 @03:28AM (#26151997)
This is exactly the kind of thing that TypeScript generated JS could help optimize. Because tsc can see that this `map` call is, in fact, Array.prototype.map, it can deduce that the lambda will get sent three values. It could generate dummy arguments for that in the JS output. It could just as easily generate a hint to the same effect in some constraint file as the GP suggests.