Closed Bug 1133298 Opened 6 years ago Closed 5 years ago

'arguments' is allowed even with rest-parameters

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla43

People

(Reporter: 446240525, Assigned: jandem)

References

Details

(Keywords: dev-doc-complete, Whiteboard: [DocArea=JS])

js> (function(...args){return arguments})(1,2,3)
SyntaxError: 'arguments' object may not be used in conjunction with a rest parameter // should be { "0": 1, "1": 2, "2": 3 }
This is what the spec says, but I still have hopes of arguing people away from this.  There's no good reason to have this doubling of work (...in the cases that can't be optimized away, at least), and at least a few reasons against -- particularly, that with a rest parameter the aliasing of parameters and arguments[i] indexes (when at least that many arguments are passed) becomes somewhat non-obvious (although I don't know if the spec handles it unambiguously or not).  So I think we should hold the fire on this one for at least a moment.
See Also: → 1175394
Depends on: 889158
No longer blocks: es6
Fixed by bug 889158. There's still bug 1175394 though but that's a separate issue.
Assignee: nobody → jdemooij
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
(In reply to Florian Scholz [:fscholz] from comment #3)
> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/
> arguments#Rest_default_and_destructured_parameters
> https://developer.mozilla.org/en-US/Firefox/Releases/43#JavaScript

Thanks for updating the docs for all those bugs.
You need to log in before you can comment on or make changes to this bug.