I hate arguments.length as well. But given that we can't get rid of it, the
occasional idiomatic use is not *that* vexing. In strict mode "arguments"
is effectively a reserved word. If the only use of "arguments" within a
strict function is "arguments.length", this will be visible both to humans
and to tools. Implementations can trivially implement this by without
reifying the arguments object, if it matters. "switch (arguments.count) {"
simply becomes an idiom that two sorts of people learn:

1) Those who wish to engage in this anti-pattern.
2) Those who wish to understand code using the anti-pattern (and possibly
berate their authors).




On Sun, Nov 10, 2013 at 2:35 PM, Brendan Eich <[email protected]> wrote:

> David Bruant wrote:
>
>> Also note that there is likely to be actual computational overhead in
>>> both creating a rest argument and in destructuring it.  In some cases, that
>>> overhead may be an issue.
>>>
>> Can implementations optimize this pattern to remove this overhead?
>>
>
> Surely they can. Will they? If it matters.
>
> I'm with you and Mark by default, we have rest, we have defaults, we don't
> need much more. But the residual arguments.length use-case is vexing.
>
> /be
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>



-- 
Text by me above is hereby placed in the public domain

  Cheers,
  --MarkM
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to