repeated parameter names and default values

Allen Wirfs-Brock allen at wirfs-brock.com
Thu Sep 27 10:36:30 PDT 2012


On Sep 27, 2012, at 9:45 AM, David Bruant wrote:
> ...
> Also, is there really a value in being able reuse a previous argument to
> define the value of another argument?
> The idea of "for the second argument, use its value unless it's
> undefined in which case, reuse the value of the first argument" smells
> like poorly designed code or API, but I'm curious if some can show a
> case where it's legitimate.
> 
> David


function doSomethingToAnArray(a, limit=a.length) {
    ...
}

Allen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120927/870c644e/attachment.html>


More information about the es-discuss mailing list