'arguments' is allowed even with rest-parameters

RESOLVED FIXED in mozilla43

Status

()

RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: 446240525, Assigned: jandem)

Tracking

({dev-doc-complete})

Trunk
mozilla43
dev-doc-complete
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [DocArea=JS])

(Reporter)

Description

4 years ago
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.
(Reporter)

Updated

4 years ago
See Also: → bug 1175394
(Assignee)

Updated

4 years ago
Depends on: 889158
No longer blocks: 694100
(Assignee)

Comment 2

4 years ago
Fixed by bug 889158. There's still bug 1175394 though but that's a separate issue.
Assignee: nobody → jdemooij
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
(Assignee)

Comment 4

4 years ago
(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.