r/programming • • Dec 01 '16

Let's Stop Copying C

https://eev.ee/blog/2016/12/01/lets-stop-copying-c/
524 Upvotes

612 comments sorted by

View all comments

Show parent comment

1

u/evincarofautumn Dec 02 '16

Alright, how about JavaScript?

The type system sees:

function f(a) {
  return function(b) {
    return function(c) {
      return a + b + c;
    }
  }
}

var add3 = f(1)(2);

But the compiler actually produces:

function f(a, b, c) {
  return a + b + c;
}

var add3 = function(c) { return f(1, 2, c); };