Function.length and Default Parameters

Brendan Eich brendan at mozilla.org
Thu Oct 11 17:49:24 PDT 2012


Kevin Smith wrote:
>
>     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:
>
> This is helpful.  So, judgement aside, we can say there is a certain 
> level of usage of Function.length out there for overloading based on a 
> function's "signature".  It seems to me that reporting Function.length 
> as the number of formal parameters, minus rest, will be more 
> appropriate for this use case.

And specifically not stopping counting at the first parameter with a 
default value, right?

/be
>
> Kevin
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss


More information about the es-discuss mailing list