Curried functions
Yongxu Ren
renyongxu at gmail.com
Thu Oct 15 20:20:23 UTC 2015
Jeremy,
I think you were talking about are cases like this:
```
let add = (x,y,...z) => x+y+Math.max(z);
```
Since rested argument always has to be the last parameter, I guess this should’t be a big problem if we can interpret this case as:
```
//regular function and the rested argument are not curried by default
let add = (x,y) => function(...z){
return x+y+Math.max(z);
};
```
As long as we express it consistently, this shouldn’t be a problem.
Also, I do not believe this will be a problem:
> Too late, ```add(a)``` already returns ```a + undefined```.
First, I do not think anyone will ever intended to write code like this,
Second, if someone accidentally returned a function instead of an object, or a different function, it should be very obvious and can be very easily debugged.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20151015/9a76b889/attachment.html>
More information about the es-discuss
mailing list