Function.length and Default Parameters

Patrick Mueller pmuellr at yahoo.com
Thu Oct 11 08:18:19 PDT 2012


On Wed, Oct 10, 2012 at 1:22 PM, Kevin Smith <khs4473 at gmail.com> wrote:

> We've discussed this extensively before and there doesn't seem to be many
>> plausible use cases for the function length property.
>
>
> Here's the only use case that I've encountered (admittedly not
> particularly strong):  Overriding the behavior of a function/method based
> on the "signature" of an input function:
>

express for node already does this, for error handlers:

    http://expressjs.com/guide.html#error-handling

express is very popular; #4 on Most Depended Upon packages; #1 on Most
Starred at npm:

   https://npmjs.org/

I will admit a certain amount of dislike for this technique, and
overloading in general; would it really be so hard to provide an
`app.useError()` API instead of 'overloading' `app.use()`?

-- 
Patrick Mueller
pmuellr at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121011/4871669a/attachment.html>


More information about the es-discuss mailing list