Curried functions

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

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

> 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', 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: <>

More information about the es-discuss mailing list