Re:How JavaScript closures work under the hood
by tel on Sunday September 06, 2015 @09:45AM
(#10177615)
There is technically a pretty significant difference between
+
function add(x, y) { return x + y; }
in general in strict, effectful languages. The transformation is called "eta expansion" (technically, I performed two eta expansions and an un-currying) and we really would like it to be valid—it implies conceptual freedom to introduce and eliminate abstractions, but it rarely is. The issue being that it introduces thunks where computation or effects can hide.
Some programming classes takes some time to describe this habit of unnecessary wrapping[2]. From
, to theses functions-written-as-classes, or even, depending on the language you use, function that wraps other functions disguised as operators [1] Java had many single method interfaces that can now be replaced by lambdas[2] see Dan Grossman proglang on Coursera (taken from his original classes at UoWashington)