var args = Args([ ... defs ... ], Array.prototype.slice.call(arguments));
var args = Args([ ... defs ... ], Array.prototype.slice.call(arguments));
The arguments object is not a real array, this is true, but it has a length and is indexable, so Args.js still works ok.
I have seen on MDN[0]:
> The arguments object is available only within a function body. Attempting to access the arguments object outside a function declaration results in an error.
It doesn't actually cause an error though, so am I misreading that? Besides, by that definition passing arguments to Array.prototype.slice.call() is also a no-no.
[0] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
> NOTE: The slice function is intentionally generic; it does not require that its this value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method. Whether the slice function can be applied successfully to a host object [ed: 'arguments' is one such] is implementation-dependent. [0]
'arguments' isn't just array-like. It's got some very weird behavior. For instance, if your function also has named parameters, and you set an index on the arguments object that corresponds with a parameter, then it changes the value of the local parameter as well.