top | item 43198274

(no title)

lindig | 1 year ago

I like the idea mentioned in the article of exploring limited higher-order functions: functions that can only take functions as argument that themselves are not taking functions as arguments. But what simplification does this buy (in the implementation of such a language) over a language that is fully functional? It is not explained in the article.

discuss

order

jasperry|1 year ago

If you return a function, the compiler has to bundle up the values of any variables that the function uses from its outer environment and return the whole package. That's known as a closure. You can't just return a function pointer.

Basically, if you don't return functions, you can avoid dealing with them "escaping" the lexical environment in which their code lives.