Curried functions

Michał Wadas michalwadas at gmail.com
Fri Oct 16 09:39:16 UTC 2015


2015-10-15 22:20 GMT+02:00 Yongxu Ren <renyongxu at gmail.com>:

>
> First, I do not think anyone will ever intended to write code like this,
>


It's a wrong assumption - tons of library code depends on some argument
being null or undefined.

function ajax(url, options) {
options = options || defaultOptions;
...
}

And in user code it can be called:

ajax('menu.html');
ajax('menu.html', null);
ajax('menu.html', undefined);


BTW - I think ES2016 needs some way to curry function without binding
`this`. Function.prototype.curry or something like that.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20151016/d3243364/attachment-0001.html>


More information about the es-discuss mailing list