Mark S. Miller (2013-11-10T21:37:52.000Z)
domenic at domenicdenicola.com (2013-11-15T18:50:17.023Z)
On Sun, Nov 10, 2013 at 1:08 PM, Allen Wirfs-Brock <allen at wirfs-brock.com>wrote: > On Nov 10, 2013, at 12:53 PM, Mark S. Miller wrote: > > Does this become common for those using DOM APIs or for those implementing > DOM APIs? If only the latter, well... > > I want to retire "arguments" as well. For these rare cases, I would use > the patterns involving "...". Combining "..." with destructuring patterns > in the body ain't too bad. > > > A problem is that the implementation signature of an API is implemented is > what is often document as the as the usage signature. So, if a lot of DOM > APIs need to be implemented as function (...args) { > > then that is likely what will appear in documentation. > Generate the documentation from the WebIDL. > 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. > When it is a performance cost, use arguments.length. I hate it, but less than adding a new feature to the language merely to make an anti-pattern more convenient. > And introducing a new default binding that's implicitly in scope without > explicit definition? C'mon Allen. "this", "arguments", "return", and > "yield" already give programmers enough TCP refactoring hazards, such as > when converting a for loop to a .forEach. How many red-flag identifiers > must programmers scan for before undertaking this refactoring? > > > that's why I suggested (...,#argCount) > If you don't want to use new syntax then a built-in binding is a fallback > solution. > I agree that #argCount is better than introducing a new builtin binding. #argCount is also better than being hit on the head with a hammer.